Commands using ps (300)

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

Print a date from 3 days ago
This command prints the Date (Not time) from 3 days ago (72 hours ago). This works on systems without GNU date (MacOSX , Solaris, FreeBSD).

Rename all files in lower case
rename is a really powerfull to, as its name suggests, rename files

Copy files to a remote host with SFTP with a leading dot, then rename them to the real file name
Usage: $ sftp-cp * | sftp user@host:/dir This is useful if there is a process on the remote machine waiting for files in an incoming directory. This way it won't see half-transmitted files if it ignores hidden files.

Poor's man Matrix script
This creates a matrix of letters that run forever until you hit Ctrl-C simulating "The Matrix" effect... just for fun :) You may want to try the -n and -y switch to change the "FX" LOL! e.g.: pwgen -ny 3

Get full from half remembered commands
Show all commands having the part known by you. Eg: $apropos pdf | less

Change SSH RSA passphrase
Protects your secret identity with a passphrase. OSX 10.6 automatically does key forwarding and can store the passphrase in the keychain. For other OSes, use ssh -A or set ForwardAgent in ssh_config to enable forwarding. Then use ssh-agent/ssh-add.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert files from DOS line endings to UNIX line endings
The old dos2unix from sysutils has been deprecated on Debian systems to this tool.

separate (emphasize) digital strings from other text

Recursive search inside the content of files under current directory - then view the result paginated with 'less'
This command will traverse all of the folders and subfolders under current working directory. For every file inside it, it will do a search inside the content of the file for a specific term 'what'. Then it will print a list of the lines that contain that term (and match that pattern). Each matching line will be preceded with the path and name to the file and then the line number iside taht file wehre the pattern was found. Then the actual content of the matching lien will be printed. The output will be piped throug less, so that the user can scroll through it if it goes beyond the limits of the current display 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: