Commands using sleep (289)

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

Jump up to any directory above the current one
Usage: upto directory

Rsync remote data as root using sudo
If your user has sudo on the remote box, you can rsync data as root without needing to login as root. This is very helpful if the remote box does not allow root to login over SSH (which is a common security restriction).

Extract ip addresses with sed
Extracts ip addressess from file using sed. Uses a tag(ip) to grep the IP lines after extracting. Must be a way to just output regex matched on sed.

Connect to google talk through ssh by setting your IM client to use the localhost 5432 port
If your firewall or proxy at your location prevents connection to a particular host or port, you can use ssh to tunnel to your home server and do it there instead.

Find how far nested you are in subshells

for x in `psql -e\l | awk '{print $1}'| egrep -v "(^List|^Name|\-\-\-\-\-|^\()"`; do pg_dump -C $x | gzip > /backups/$x-back.gz
Ran as the postgres user, dumps each database individually. It dumps with the create statements as well, so you can just 'zcat $x-nightly.dmp.gz | psql' to reimport/recreate a database from a backup.

Numerically sorted human readable disk usage
Provides numerically sorted human readable du output. I so wish there was just a du flag for this.

View and review the system process tree.
The "pstree" command uses special line-drawing characters. However, when piped into the "less" pager, these are normally disabled.

Print only the odd lines of a file
NR%2 == 1 on odd lines and 0 on even lines

Resume a detached screen session, resizing to fit the current terminal
By default, screen tries to restore its old window sizes when attaching to resizable terminals. This command is the command-line equivalent to typing ^A F to fit an open screen session to the window.


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: