Get user's full name in Mac OS X
$ finger $(whoami) | egrep -o 'Name: [a-zA-Z0-9 ]{1,}' | cut -d ':' -f 2 | xargs echo Its possible to user a simple regex to extract de username from the finger command. The final echo its optional,...
View Articlefind xargs mv
$ find . -iname "*.mp4" -print0 | xargs -0 mv --verbose -t /media/backup/ View this command to comment, vote or add to favourites View all commands by hochmeister Diff your entire server config at...
View ArticleInstall every (not already installed) component of the Google Cloud SDK
$ gcloud components list | grep "^| Not" | sed "s/|\(.*\)|\(.*\)|\(.*\)|/\2/" | xargs echo gcloud components update Google Cloud SDK comes with a package manager `gcloud components` but it needs a bit...
View ArticleFind Duplicate Files (based on size first, then MD5 hash)
$ find -not -empty -type f -printf "%-30s'\t\"%h/%f\"\n" | sort -rn -t$'\t' | uniq -w30 -D | cut -f 2 -d $'\t' | xargs md5sum | sort | uniq -w32 --all-repeated=separate Finds duplicates based on MD5...
View ArticleFind class in jar
$ find . -name '*.jar' | xargs -l jar vtf | grep XXX.java View this command to comment, vote or add to favourites View all commands by zluyuer Diff your entire server config at ScriptRock.com
View ArticleGit fetch all remote branches
$ git branch -r | awk -F'/' '{print "git fetch "$1,$2}' | xargs -I {} sh -c {} View this command to comment, vote or add to favourites View all commands by cakyus Diff your entire server config at...
View Articleoptimize all png images
$ find . -name *.png | xargs optipng -nc -nb -o7 -full View this command to comment, vote or add to favourites View all commands by homoludens Diff your entire server config at ScriptRock.com
View Articleconvert png images to jpg and optimize them
$ ls *.png | cut -d . -f 1 | xargs -L1 -i convert -strip -interlace Plane -quality 80 {}.png {}.jpg View this command to comment, vote or add to favourites View all commands by homoludens Diff your...
View ArticleUpgrade all expired homebrew packages
$ brew outdated | cut -f1 | xargs brew upgrade You probably want to run `brew update` before you run this command View this command to comment, vote or add to favourites View all commands by wires Diff...
View ArticleUpgrade pip-installed python packages
$ python -c "import pip; print(' '.join([x.project_name for x in pip.get_installed_distributions()]))" | xargs sudo pip install -U View this command to comment, vote or add to favourites View all...
View ArticleMove all located items to folder
$ locate -0 -i *barthes* | xargs -0 mv -t ~/'Library/Books/Barthes, Roland' Find all books on my systems and move them into folder. The -0 switches are to handle spaces etc. in the filenames. Why would...
View Articlecount all the lines of code in a directory recursively
$ find . -name '*.php' | xargs wc -l count all the lines of code in specific directory recursively in this case only *.php can be *.* View this command to comment, vote or add to favourites View all...
View ArticleDelete all local git branches that have been merged
$ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d This checks if the branch has been merged with master and then will delete the ones that have been. Keeps your local git repo nice and...
View ArticleFind which fibre HBA a disk is connected to
$ udevadm info -q all -n /dev/sdc | grep ID_PATH | cut -d'-' -f 2 | xargs -n 1 lspci -s Useful for big systems with lots of cards. (Update: does not work with USB disks) View this command to comment,...
View ArticleFind the date of the first commit in a git repository
$ git rev-list --all|tail -n1|xargs git show|grep -v diff|head -n1|cut -f1-3 -d' ' Finds the date of the first commit in a git repository branch View this command to comment, vote or add to favourites...
View ArticleFind the date of the first commit in a git repository
$ git rev-list --all|tail -n1|xargs git show|grep -v diff|head -n1|cut -f1-3 -d' ' Finds the date of the first commit in a git repository branch View this command to comment, vote or add to favourites...
View ArticleFind common groups between two users
$ groups user1 user2|cut -d: -f2|xargs -n1|sort|uniq -d Updated according to flatcap's suggestion, thanks! View this command to comment, vote or add to favourites View all commands by swemarx Diff your...
View Articledraw rhomb
$ a=$(b=$(($LINES/2));f() { for c in $(seq $b); do for i in $(seq $c);do echo x;done|xargs echo;done };paste <(f) <(f|tac|tr 'x' '-') <(f|tac|tr 'x' '-') <(f)|tr '\t' ' ');(cat...
View ArticleExport MySQL tables that begin with a string
$ sudo mysql -sNe 'show tables like "PREFIX_%"' DBNAME | xargs sudo mysqldump DBNAME > /tmp/dump.sql View this command to comment, vote or add to favourites View all commands by shadyvb Diff your...
View ArticleDownload all manuals RedHat 7 (CentOS/Fedora) with one command in Linux
$ wget -q -O- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/ | grep Linux/7/pdf | cut -d \" -f 2 | awk '{print "https://access.redhat.com"$1}' | xargs wget View this command to...
View Article