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

Arch Linux sort installed packages by size
This one-liner will output installed packages sorted by size in Kilobytes.

Found how how much memory in kB $PID is occupying in Linux
The "proportional set size" is probably the closest representation of how much active memory a process is using in the Linux virtual memory stack. This number should also closely represent the %mem found in ps(1), htop(1), and other utilities.

exclude a column with cut
Show all columns except 5th. This might help you save some typing if you are trying to exclude some columns from the output.

save date and time for each command in history
for the change stay in your history file , export command by writing it into your .bashrc

Stripping ^M at end of each line for files
That "^M" is Ctrl-M, which is a carriage return, and is not needed in Unix file systems. Where ^V is actually Ctrl-V and ^M is actually Ctrl-M (you must type these yourself, don't just copy and paste this command). ^V will not be displayed on your screen.

Random Number Between 1 And X
If X is 5, it will about a number between 1 and 5 inclusive. This works in bash and zsh. If you want between 0 and 4, remove the +1.

ssh autocomplete
Add to your bash profile to minimize carpal tunnel syndrome. Doesn't work with user@hostname but appending "-l user" works fine if needed. Works for ping as well.. complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ping

Install pip with Proxy
Installs pip packages defining a proxy

View user activity per directory.
View all files opened by a user in specified directory. The +D option makes lsof search all sub-directories to complete depth, while ignoring symbolic links.

Recursively remove all files in a CVS directory
This will search all directories and ignore the CVS ones. Then it will search all files in the resulting directories and act on them.


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: