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

Synchronise a file from a remote server
You will be prompted for a password unless you have your public keys set-up.

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Screenshot pipe to remote host, adding URL to clipboard, notifying when done. (without saving locally)
Requires you to have password free login to remote host ;) Requires xclip and notify-send (If you want to put into clipboard and be notified when action is completed). DATE=$(date +%Y-%m-%d_%H-%M-%S)-$(($(date +%N)/10000000)); HOST="ssh host of your choice"; DEST="destination folder without trailing slash"; URL="URL for file if uploaded to web enabled dir ie. http://$HOST/~user/screenshot_$DATE.png"; import -window root png:- | ssh $HOST "cat > $DEST/screenshot_$DATE.png"; echo $URL | xclip; notify-send -u low "Screenshot Taken" "Entire screen.\nCopied to clipboard"

To convert **.wav to **.mp3 using LAME running one process per CPU core run:

ssh autocomplete based on ~/.ssh/config
I sue this in my .bashrc file This will also do auto-completion for scp and sftp

Break lines after, for example 78 characters, but don't break within a word/string
Per default, linux/unix shells are configured with a width of 80 characters. If you like to edit a phrase or string on a line with more than 80 characters it might take long to go there (for example a line with 1000 characters and you like to edit the 98th word which is character 598-603). Maybe you might wish to use 78 characters, because if you forward the text via mail and the text will be quoted (2 extra characters at the beginning to the line "> "), you use 80 characters, otherwise 82, which are lame.

Compute newest kernel version from Makefile on Torvalds' git repository
The platform-agnostic version of https://www.commandlinefu.com/commands/view/25276/compute-newest-kernel-version-from-makefile-on-torvalds-git-repository because macOS doesn't have wget installed

Resample a WAV file with sox
Change the sample rate with sox, the swiss army knife of sound processing.

Command to rename multiple file in one go
An entirely shell-based solution (should work on any bourne-style shell), more portable on relying on the rename command, the exact nature of which varies from distro to distro.

Create a CD/DVD ISO image from disk.


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: