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

Sort files in folders alphabetically
Creates one letter folders in the current directory and moves files with corresponding initial in the folder.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

Change wallpaper for xfce4 >= 4.6.0
Simply changes the wallpaper of xfce4 from the command line. Not for multiple displays.

archlinux: shows list of files installed by a package
Shows the files which the package, for example gvim, installed on your system.

lists files and folders in a folder
lists files and folders in a folder with summary.

Open a file explorer on a split screen inside your vim session
Open a CLI file explorer by splitting up your screen inside your vim session. Besides, you probably are never going to forget this one.

easily strace all your apache *child* processes
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.

create tar archive of files in a directory and its sub-directories
creates a compressed tar archive of files in /path/foo and writes to a timestamped filename in /path.

Enter a command but keep it out of the history
Put a space in front of your command on the command line and it will not be logged as part of your command line history.


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: