commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Binary clock with separate H:M:S.
This is maybe helpfull from system overheat on your linux box
1) -n option of watch accepts seconds
2) -t option of notify-send accepts milliseconds
3) All quotes stated in the given example are required if notification
message is more than a word.
4) I couldn't get this to run in background (use of & at the end fails). Any
To monitor .vmdk files during snapshot deletion (commit) on ESX only (ESXi doesn't have the watch command):
1. Navigate to the VM directory containing .vmdk files.
# watch "ls -tough --full-time *.vmdk"
-t sorts by modification time
-o do not list group information (to narrow the output)
-u sorts by access time
-g only here for the purpose to easily remember the created mnemonic word 'tough'
-h prints sizes in human readable format (e.g., 1K 234M 2G)
--full-time sets the time style to full-iso and does not list user information (to narrow the output)
optionally useful parameters to the watch command:
-d highlight changes between updates
-n seconds to wait between updates (default is 2)
-t turn off printing the header
Change HH:MM with your target time.
This is for a Debian/Ubuntu GNU system. You need bash (package bash), date (package coreutils) and toilet (package toilet). Install with:
# apt-get install bash coreutils toilet toilet-fonts
Figlet is easy to find for download on the internet, and works for any text. Quite cool.
This command shows the size of directories below here, refreshing every 2s.
It will also track directories created after running the command (that what the find bit does).
Show active calls as the happen on an Asterisk server. Note that the Asterisk command (in single quotes) is formatted for Asterisk 1.6. Use the -n flag on the watch command to modify the refresh period (in seconds - default is 2 seconds).
-n means refresh frequency
you could change eth0 to any interface you want, like wlan0
Show a simple table with disk IO for the specified host. you monitor a LOT of different thing. Mostly used for MRTG and similar, but this is nice for a quick look, which disk is busy.
"public" is your SNMP community
ensure that snmpd is running on the host which you intend to monitor
It's not my code, but I found it useful to know how many open connections per request I have on a machine to debug connections without opening another http connection for it.
You can also decide to sort things out differently then the way it appears in here.
You can substitute /home/$USER with any path you like.
Useful with new unknown devices or just monitoring, probably useful for the sysadmin. Updates every 2 seconds. More here: http://linuxclisecurity.blogspot.com/2009/12/monitor-kernel-ring-buffer.html.
I wanted to create a copy of my whole laptop disk on an lvm disk of the same size.
First I created the logical volume: lvcreate -L120G -nlaptop mylvms
SOURCE: dd if=/dev/sda bs=16065b | netcat ip-target 1234
TARGET: nc -l -p 1234 | dd of=/dev/mapper/mylvms-laptop bs=16065b
to follow its process you issue the following command in a different terminal
STATS: on target in a different terminal: watch -n60 -- kill -USR1 $(pgrep dd)
if you start a large dd and forgot about statistics, but you still wonder what the progress is this command in an OTHER terminal will show you the way.
NOTE: the watch command by itself will not output anything
NOTE: the kill command will not kill the process
This command is a great way to check to see if acpi is doing damage to your disks by agressivly parking the read arm and wearing down it's life. As you can see, mine has lost half its life. I'm sure this could be shortened though somehow. It will use smartctl to dump the stats and then grep out just the temperature and load cycles for the disk (a load cycle is when a the read arm comes out of park and wears on the drive).
Monitor with watch command and vmstat, memory usage
On my cluster a D in the states column means it is time to reboot the server.
If you just executed some long command, like "ps -aefww | grep -i [m]yProcess", and if you don't want to retype it or cycle backwards in history and waste time quoting it, then you can use history substitution.
Create a binary clock.