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

make 100 directories with leading zero, 001...100, using bash3.X

copy string to clipboard
Copy the current path. Use -selection clipboard to copy the string to clipboard.

Get full from half remembered commands
Show all commands having the part known by you. Eg: $apropos pdf | less

access to last touched or created file with arrow_up_key immediately after displaying the file list
Display recursive file list (newest file displayed at the end) and be free to access last file in the list simply by pressing arrow_up_key i.e. open it with joe editor. BTW IMHO the list of files with newest files at the end is often more informative. Put this 'lsa' function somewhere in your .bashrc and issue $ . ~/.bashrc or $ source ~/.bashrc to have access to the 'lsa' command immediately. . (the function appends command "joe last_file_in_the_list" at the end of command history)

List 10 largest directories in current directory
Directories listed in human-readable format

Do some learning...
compgen -c finds everything in your path.

A line across the entire width of the terminal
Use tput cols to find the width of the terminal and set it as the minimum field width.

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Determine space taken by files of certain type
Just how much space are those zillions of database logs taking up ? How much will you gain on a compression rate of say 80% ? This little line gives you a good start for your calculations.

continuously check size of files or directories
very handy if you copy or download a/some file(s) and want to know how big it is at the moment


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: