Commands by cadejscroggins (5)

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

Press Any Key to Continue
Halt script progress until a key has been pressed. Source: http://bash-hackers.org/wiki/doku.php/mirroring/bashfaq/065

Make changes in any profile available immediately/Change to default group
Changes your group to the default group, has the same effect as sourcing your profile/rc file (in any shell) or logging out and back in again.

run command on a group of nodes in parallel
The pee command is in the moreutils package.

grep for minus (-) sign
Use flag "--" to stop switch parsing

backup directory. (for bash)

Install a LAMP server in a Debian based distribution
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.

Delete files older than..
This command will delete files i a given path (/dir_name) , which older than given time in days (-mtime +5 will delete files older than five days.

truncate deleted files from lsof
While the posted solution works, I'm a bit uneasy about the "%d" part. This would be hyper-correct approach: $ lsof|gawk '$4~/txt/{next};/REG.*\(deleted\)$/{sub(/.$/,"",$4);printf ">/proc/%s/fd/%s\n", $2,$4}' Oh, and you gotta pipe the result to sh if you want it to actually trim the files. ;) Btw, this approach also removes false negatives (OP's command skips any deleted files with "txt" in their name).

Random unsigned integer
Reads 4 bytes from the random device and formats them as unsigned integer between 0 and 2^32-1.

Delete all non-printing characters from a file
tr has some predefined sets of characters that are more convenient to use than characters codes


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: