Commands by unixmonkey34223 (1)

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

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

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

Show current working directory of a process

convert filenames in current directory to lowercase

Extracting a range of pages from a PDF, using GhostScript
In this example we extract pages 14-17

scp a good script from host A which has no public access to host C, but with a hop by host B
middlehost allows ssh access from where you are but not securehost. Use nice ssh piping to simulate scp through A => B => C setting up the shell function if left as an exercise for the reader. ;-) Agent forwarding should avoid password typing.

Show permissions of current directory and all directories upwards to /
NB not 'namei -m .', as it slices the path you give it.

Remove newlines from output
?Cat and grep? You can use only grep ("grep \. filename"). Better option is awk.

command shell generate random strong password
shell generate random strong password

Using Git, stage all manually deleted files.
You'll probably want to pass in the -rf options if you have to delete a directory or something.


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: