
Terminal - Commands using cut - 408 results
free -b | grep "Swap:" | sed 's/ * / /g' | cut -d ' ' -f2
This is sample output - yours may be different.
This is sample output - yours may be different.
ls *.c | while read F; do gcc -Wall -o `echo $F | cut -d . -f 1 - ` $F; done
This is sample output - yours may be different.
Compile *.c files with "gcc -Wall" in actual directory, using as output file the file name without extension.
sudo aptitude unmarkauto $(apt-cache depends some-deb-meta-package-name | grep Depends | cut -d: -f2)
This is sample output - yours may be different.
Debian: Mark all dependent packages as manually installed. So they are not automatically removed if you remove some meta package - like gnome-desktop-environment for example.
mount -t ntfs-3g -o ro,loop,uid=user,gid=group,umask=0007,fmask=0117,offset=0x$(hd -n 1000000 image.vdi | grep "eb 52 90 4e 54 46 53" | cut -c 1-8) image.vdi /mnt/vdi-ntfs
This is sample output - yours may be different.
for i in `grep "unable to stat" /var/log/syslog | cut -d "/" -f 3 | sort | uniq`; do find /var/qmail/queue -name $i -type f -exec rm -v {} \; ; done
This is sample output - yours may be different.
for kern in $(grep "initrd " /boot/grub/grub.conf|grep -v ^#|cut -f 2- -d-|sed -e 's/\.img//g'); do mkinitrd -v -f /boot/initrd-$kern.img $kern; done
This is sample output - yours may be different.
sudo du -ks $(ls -d */) | sort -nr | cut -f2 | xargs -d '\n' du -sh 2> /dev/null
This is sample output - yours may be different.
This allows the output to be sorted from largest to smallest in human readable format.
find . -type f -printf '%20s %p\n' | sort -n | cut -b22- | tr '\n' '\000' | xargs -0 ls -laSr
This is sample output - yours may be different.
-rw-r--r-- 1 fsilveira fsilveira 542537728 2001-10-03 19:29 ./rh72/enigma-SRPMS-disc2.iso
-rw-r--r-- 1 fsilveira fsilveira 624476160 2001-10-03 19:35 ./rh72/enigma-docs.iso
-rw-r--r-- 1 fsilveira fsilveira 669429760 2001-10-03 19:24 ./rh72/enigma-i386-disc2.iso
-rw-r--r-- 1 fsilveira fsilveira 677961728 2001-10-03 19:22 ./rh72/enigma-i386-disc1.iso
-rw-r--r-- 1 fsilveira fsilveira 680282112 2001-10-03 19:27 ./rh72/enigma-SRPMS-disc1.iso
This command will find the biggest files recursively under a certain directory, no matter if they are too many. If you try the regular commands ("find -type f -exec ls -laSr {} +" or "find -type f -print0 | xargs -0 ls -laSr") the sorting won't be correct because of command line arguments limit.
This command won't use command line arguments to sort the files and will display the sorted list correctly.
nmap -n -iR 0 -sL | cut -d" " -f 2
This is sample output - yours may be different.
136.159.200.131
188.52.81.164
67.192.148.226
192.136.218.176
93.242.113.87
112.209.160.94
(... ad infinitum ...)
host $HOSTNAME|cut -d' ' -f4
This is sample output - yours may be different.
Using DynDNS or a similar service not only allows access to your home machine from outside without needing to know what IP the ISP has assigned to it but it also comes in handy if you want to know your external IP address. The only purpose of the sed command is to remove the leading "host.na.me has address " part from the output. If you don't need to discard it you can simply use
host $HOSTNAME
ips(){ for if in ${1:-$(ip link list|grep '^.: '|cut -d\ -f2|cut -d: -f1)};do cur=$(ifconfig $if|grep "inet addr"|sed 's/.*inet addr:\([0-9\.]*\).*/\1/g');printf '%-5s%-15s%-15s\n' $if $cur $(nc -s $cur sine.cluenet.org 128 2>/dev/null||echo $cur);done;}
This is sample output - yours may be different.
nathan@lion:~$ ips
lo 127.0.0.1 127.0.0.1
eth0 192.168.1.2 80.106.232.129
nathan@lion:~$ ips eth0
eth0 192.168.1.2 80.106.232.129
Gets the internal and external IP addresses of all your interfaces, or the ones given as arguments
dd if=/dev/urandom count=200 bs=1 2>/dev/null | tr "\n" " " | sed 's/[^a-zA-Z0-9]//g' | cut -c-16
This is sample output - yours may be different.
html2text http://checkip.dyndns.org | grep -i 'Current IP Address:'|cut -d' ' -f4
This is sample output - yours may be different.
The same as the other user, but smarter, using -d and -f
html2text http://checkip.dyndns.org | grep -i 'Current IP Address:'|cut -c21-36
This is sample output - yours may be different.
grep -Eho '<[a-ZA-Z_][a-zA-Z0-9_-:]*' * | sort -u | cut -c2-
This is sample output - yours may be different.
a
b
body
br
center
div
fieldset
font
form
func:function
func:result
h1
h2
h4
head
html
i
img
input
label
li
link
meta
noscript
option
p
sc
script
select
span
strong
style
table
tbody
td
textarea
th
title
tr
ul
xsl:apply-templates
xsl:attribute
xsl:call-template
xsl:choose
xsl:copy-of
xsl:for-each
xsl:if
xsl:include
xsl:otherwise
xsl:param
xsl:stylesheet
xsl:template
xsl:text
xsl:value-of
xsl:variable
xsl:when
xsl:with-param
This one will work a little better, the regular expressions it is not 100% accurate for XML parsing but it will suffice any XML valid document for sure.
find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 | cut -c 35-
This is sample output - yours may be different.
Calculates md5 sum of files. sort (required for uniq to work). uniq based on only the hash. use cut ro remove the hash from the result.
copy(){ cp -v "$1" "$2"&watch -n 1 'du -h "$1" "$2";printf "%s%%\n" $(echo `du -h "$2"|cut -dG -f1`/0.`du -h "$1"|cut -dG -f1`|bc)';}
This is sample output - yours may be different.
echo $( du -sm /var/log/* | cut -f 1 ) | sed 's/ /+/g'
This is sample output - yours may be different.
1+1+1+1+1+1+1+1+1+1+1+1+1+0+11+2+10+14+21+19+19+21+1+1+1+1
When you've got a list of numbers each on its row, the ECHO command puts them on a simple line, separated by space. You can then substitute the spaces with an operator. Finally, pipe it to the BC program.
echo -e "HEAD / HTTP/1.1\nHost: slashdot.org\n\n" | nc slashdot.org 80 | head -n5 | tail -1 | cut -f2 -d-
This is sample output - yours may be different.
dpkg --get-selections | grep -v deinstall | cut -f 1
This is sample output - yours may be different.
acpi
acpi-support
acpi-support-base
acpid
adduser
anacron
ant
antlr
apmd
apt
apt-utils
aptitude
aspell
Should work on all systems that use dpkg and APT package management.
for file in *.001; do NAME=`echo $file | cut -d. -f1,2`; cat "$NAME."[0-9][0-9][0-9] > "$NAME"; done
This is sample output - yours may be different.
file.avi.001
file.avi.002
file.avi.003
file.avi.004
another.avi.001
another.avi.002
another.avi.003
another.avi.004
another.avi.005
another.avi.006
more.avi.001
more.avi.002
more.avi.003
more.avi.004
more.avi.005
becomes:
file.avi
another.avi
more.avi
If you use newsgroups then you'll have come across split files before. Joining together a whole batch of them can be a pain so this will do the whole folder in one.
ifconfig | grep "inet [[:alpha:]]\+" | cut -d: -f2 | cut -d' ' -f2
This is sample output - yours may be different.
192.168.135.123
127.0.0.1
Get the IP address of all your network cards.
ifconfig | grep "inet addr" | cut -d: -f2 | cut -d' ' -f1
This is sample output - yours may be different.
/sbin/ifconfig | grep inet | cut -f 2 -d ":" | cut -f 1 -d " " |egrep -v "^$"
This is sample output - yours may be different.
to clean up the extra lines