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

To create files with specific permission:

Remount root in read-write mode.
Saved my day, when my harddrive got stuck in read-only mode.

Make backups recurse through directories

Command to Show a List of Special Characters for bash prompt (PS1)
I use this command (PS1) to show a list bash prompt's special characters. I tested it against A flavor of Red Hat Linux and Mac OS X

copy with progress bar - rsync
-r for recursive (if you want to copy entire directories) src for the source file (or wildcards) dst for the destination --progress to show a progress bar

Find ulimit values of currently running process
When dealing with system resource limits like max number of processes and open files per user, it can be hard to tell exactly what's happening. The /etc/security/limits.conf file defines the ceiling for the values, but not what they currently are, while $ ulimit -a will show you the current values for your shell, and you can set them for new logins in /etc/profile and/or ~/.bashrc with a command like: $ ulimit -S -n 100000 >/dev/null 2>&1 But with the variability in when those files get read (login vs any shell startup, interactive vs non-interactive) it can be difficult to know for sure what values apply to processes that are currently running, like database or app servers. Just find the PID via "ps aux | grep programname", then look at that PID's "limits" file in /proc. Then you'll know for sure what actually applies to that process.

Network traffic on NICs in mbps without sar, iperf, etc...
Need output in mbps (bits) # ./bytes-second.sh eth0 eth0 interface maximum Speed: 1000Mb/s RX:12883212 TX:17402002 B/s | RX:98 TX:132 Mb/s RX:12371647 TX:17830111 B/s | RX:94 TX:136 Mb/s RX:12502750 TX:17860915 B/s | RX:95 TX:136 Mb/s

Show account security settings
Show account security settings

Paste OS X clipboard contents to a file on a remote machine
Redirects the contents of your clipboard through a pipe, to a remote machine via SSH.

Add forgotten changes to the last git commit
It's pretty common to forgot to commit a files, be it a modification, or a brand new file. If you did forget something, git add the files you want, and then git commit --amend. It will essentially redo the last commit, with the changes you just added. It seeds the commit message with the last commit message by default. You probably shouldn't do this if you've already pushed the commit.


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: