All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

follow the content of all files in a directory
The `-q' arg forces tail to not output the name of the current file

checks size of directory & delete it if its to small
only simple example how to combine rclone & jq

SHA256 signature sum check of file
get the SHA256 sum signatur for a file

Generate a playlist of all the files in the directory, newer first
I use this to generate a playlist with all the podcasts I listen to. Ordered from most recent to older.

find out how many days since given date
Exactly the same number of characters, exactly the same results, but with bc

Top ten (or whatever) memory utilizing processes (with children aggregate)
This command loops over all of the processes in a system and creates an associative array in awk with the process name as the key and the sum of the RSS as the value. The associative array has the effect of summing a parent process and all of it's children. It then prints the top ten processes sorted by size.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

calulate established tcp connection of local machine
If you want prepend/append text just wrap in echo: $echo Connected: `netstat -an|grep -ci "tcp.*established"`

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Unzip and untar a *.tar.gz file in one go to a specific directory
A *.tar.gz file needs to be unzipped & then untarred. Previously I might have unzipped first with $gunzip -d file.tar.gz and then untarred the result with $tar -xvf file.tar (Options are extract, verbose, file) Using the -z (decompress) option on tar avoids the use of gzip (or gunzip) first. Additionally the -C option will specify the directory to extract to.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: