Using xargs is better than:
find /path/to/dir -type f -exec rm \-f {} \;
as the -exec switch uses a separate process for each remove. xargs splits the streamed files into more managable subsets so less processes are required.
This greps all PHP files for a given classname and displays both the file and the usage. Show Sample Output
Useful when you forget to use sudo for a command. "!!" grabs the last run command.
Creates a command alias ('cr' in the above example) that searches the contents of files matching a set of file extensions (C & C++ source-code in the above example) recursively within the current directory. Search configured to be in colour, ignore-case, show line numbers and show 4 lines of context. Put in shell initialisation file of your choice. Trivially easy to use, e.g:
cr sha1_init
Show Sample Output
Recursively searches current directory and outputs sorted list of each directory's disk usage to a text file. Show Sample Output
This can be useful when a large remove operation is taking place.
This is an alternative to cron which allows a one-off task to be scheduled for a certain time.
This uses awk to grab the IP address from each request and then sorts and summarises the top 10.
ps returns all running processes which are then sorted by the 4th field in numerical order and the top 10 are sent to STDOUT. Show Sample Output
See http://dev.mysql.com/doc/refman/5.0/en/myisamchk.html for further details. You can also repair all tables by running:
myisamchk -r *.MYI
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.
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
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: