
Terminal - Commands using cut - 500 results
teste.txt < cut -d : -f 1,5 /etc/passwd | tr : \\t | tr a-z A-Z | cat teste.txt
This is sample output - yours may be different.
for i in $(netstat --inet -n|grep ESTA|awk '{print $5}'|cut -d: -f1);do geoiplookup $i;done
This is sample output - yours may be different.
GeoIP Country Edition: ES, Spain
GeoIP Country Edition: IT, Italy
GeoIP Country Edition: IT, Italy
GeoIP Country Edition: SE, Sweden
GeoIP Country Edition: NL, Netherlands
GeoIP Country Edition: ES, Spain
GeoIP Country Edition: SE, Sweden
Sample command to obtain a list of geographic localization for established connections, extracted from netstat. Need geoiplookup command ( part of geoip package under CentOS)
ord () { seq 1 127 | while read i; do echo `chr $i` $i; done | grep "^$1 " | cut -c '3-' }
This is sample output - yours may be different.
uses the previous "chr" function and uses it to create the inverse function "ord" by brute force.
It's slow, It's inelegant, but it works.
I thought I needed ord/chr to do a cartesian cipher in shell script a whie ago, but eventualy I realized I could get fancy with tr and do the same thing...
echo $RANDOM$RANDOM$RANDOM |cut -c3-12
This is sample output - yours may be different.
dpkg --get-selections | cut -f1 | while read pkg; do dpkg -L $pkg | xargs -I'{}' bash -c 'if [ ! -d "{}" ]; then echo "{}"; fi' | tr '\n' '\000' | du -c --files0-from - | tail -1 | sed "s/total/$pkg/"; done
This is sample output - yours may be different.
176 acl
44 acpi
396 acpi-support
32 acpi-support-base
108 acpid
524 adduser
408 akonadi-server
2416 akregator
388 alsa-base
1840 alsa-utils
1860 amor
96 anacron
120 apmd
4512 apt
104 apt-file
376 apt-utils
140 apt-xapian-index
9184 aptitude
112 at
104 avahi-autoipd
252 avahi-daemon
260 base-files
100 base-passwd
du: cannot access `diverted by dash to: /usr/share/man/man1/sh.distrib.1.gz': No such file or directory
du: cannot access `diverted by dash to: /bin/sh.distrib': No such file or directory
Calculates the size on disk for each package installed on the filesystem (or removed but not purged). This is missing the
| sort -rn
which would put the biggest packges on top. That was purposely left out as the command is slightly on the slow side
Also you may need to run this as root as some files can only be checked by du if you can read them ;)
b="http://2010.utosc.com"; for p in $( curl -s $b/presentation/schedule/ | grep /presentation/[0-9]*/ | cut -d"\"" -f2 ); do f=$(curl -s $b$p | grep "/static/slides/" | cut -d"\"" -f4); if [ -n "$f" ]; then echo $b$f; curl -O $b$f; fi done
This is sample output - yours may be different.
http://2009.utosc.com/static/slides/Crowdsourcing_UTOSC.ppt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4819k 100 4819k 0 0 300k 0 0:00:16 0:00:16 --:--:-- 250k
miss a class at UTOSC2010? need a refresher? use this to curl down all the presentations from the UTOSC website. (http://2010.utosc.com) NOTE/WARNING this will dump them in the current directory and there are around 37 and some are big - tested on OSX10.6.1
find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
This is sample output - yours may be different.
>find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
694 Source
312 Defaults
50 Makeinfo
5 CVS
1 .
counts the total (recursive) number of files in the immediate (depth 1) subdirectories as well as the current one and displays them sorted.
Fixed, as per ashawley's comment
find ~/Music -daystart -mtime -60 -name *mp3 -printf "%T@\t%p\n" | sort -f -r | head -n 30 | cut -f 2
This is sample output - yours may be different.
sitepass() { echo -n "
[email protected]" | md5sum | sha1sum | sha224sum | sha256sum | sha384sum | sha512sum | gzip - | strings -n 1 | tr -d "[:space:]" | tr -s '[:print:]' | tr '!-~' 'P-~!-O' | rev | cut -b 2-11; history -d $(($HISTCMD-1)); }
This is sample output - yours may be different.
$ sitepass iHeartLinux commandlinefu.com
^Uk+j{,jl~
usage: sitepass MaStErPaSsWoRd example.com
description: An admittedly excessive amount of hashing, but this will give you a pretty secure password, It also eliminates repeated characters and deletes itself from your command history.
tr '!-~' 'P-~!-O' # this bit is rot47, kinda like rot13 but more nerdy
rev # this avoids the first few bytes of gzip payload, and the magic bytes.
ssh-keygen -R `host hostname | cut -d " " -f 4`
This is sample output - yours may be different.
Quick shortcut if you know the hostname and want to save yourself one step for looking up the IP address separately.
This is sample output - yours may be different.
lsof -P -i -n | cut -f 1 -d " "| uniq | tail -n +2
This is sample output - yours may be different.
kopete
ktorrent
firefox-b
show only the name of the apps that are using internet
file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i x86_64 |nl | tail -1 | cut -f1 -f3; file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i "mach-o object i386" |nl | tail -1 | cut -f1 -f3
This is sample output - yours may be different.
127 Mach-O 64-bit kext bundle x86_64
140 Mach-O object i386
Not as far off as you thought, now is it?
-mac fanboy
function nowrap { export COLS=`tput cols` ; cut -c-$COLS ; unset COLS ; }
This is sample output - yours may be different.
grep -oE "ssid=\".*\"" /etc/wpa_supplicant.conf | cut -c6- | sed s/\"//g | zenity --list --title="Choose Access Point" --column="SSID"
This is sample output - yours may be different.
If you still connect to your wireless access point manually and need to use wpa_supplicant, the above fu will grep all of the known SSID from your wpa_supplicant.conf file, present it in a Zenity list and return the SSID name you choose. I've wrapped this command in to a bash script that then up's the interface, associates and autenticates. Saves me from using NetworkManager ;)
du -a --max-depth=1 | sort -n | cut -d/ -f2 | sed '$d' | while read i; do if [ -f $i ]; then du -h "$i"; else echo "$(du -h --max-depth=0 "$i")/"; fi; done
This is sample output - yours may be different.
Based on the MrMerry one, just add some visuals to differentiate files and directories
find . -maxdepth 1 -type d|xargs du -a --max-depth=0|sort -rn|cut -d/ -f2|sed '1d'|while read i;do echo "$(du -h --max-depth=0 "$i")/";done;find . -maxdepth 1 -type f|xargs du -a|sort -rn|cut -d/ -f2|sed '$d'|while read i;do du -h "$i";done
This is sample output - yours may be different.
Based on the MrMerry one, just add some visuals and sort directory and files
file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i x86_64 |nl |tail -1 |cut -f1 -f3 && file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -v x86_64 |nl |tail -1 |cut -f1 -f3
This is sample output - yours may be different.
127 Mach-O 64-bit kext bundle x86_64
314 Mach-O object i386
Next time you see a mac fanboy bragging about 64-bitness of 10.6 give him this so he might sh?
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.