Can pipe to tail or change the awk for for file size, groups, users, etc. Show Sample Output
# Small for loop, that can list files in dir, and after that executes # [COMMAND] of your choice, usefull for example rename, move, tar etc.. # change cmd's for different results :)
Do stuff with each file in a directory.
Create an alias to list all contents of the current directory in "reverse" time order. Thus the last modified file will appear just above your next prompt. Useful for remembering where you left off modifying files in a folder or just noting recent changes. csh format but bash syntax similar
set colsep "&TAB" -- for tab separator set colsep "|" -- for pipe separator etc...
Will rot 13 whatever parameter follows 'rot13', whether it is a string or a file. Additionally, it will rot 5 each digit in a number
Select a file/folder at random. Show Sample Output
Looks like you're stuck with sed if your ls doesn't have a -Q option.
Credit goes to "eightmillion" Show Sample Output
This command lists extended information about files, i.e. whether or not it is a true file or link, who owns it, etc. without having to 'ls' from the specific directory. If you know the filename, but not the location, this helps with finding other information about the file. It can be truncated by creating an alias for 'ls -l'. The sample output shows difference in regular locate vs. ls + locate. Show Sample Output
This will only work on files since ls won't tell the size of a directory contents. Note that the first switch is the digit one, not the letter ell.
Works 99.9% of the time; so far never required a more complex expression in manual input.
Ever need to output an entire directory and subdirectory contents to a file? This is a simple one liner but it does the trick every time. Omit -la and use only -R for just the names
Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all... At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc So for a specific port, this line returns the calling command line of every thread that handle the associated socket
This command will grep the entire directory looking for any files containing the list of files. This is useful for cleaning out your project of old static files that are no longer in use. Also ignores .svn directories for accurate counts. Replace 'static/images/' with the directory containing the files you want to search for. Show Sample Output
if you lose your sound, this will restart alsa and you will get your sound back
some people on the net already use a cd(), but most of them break 'cd -' functionality, that is "go back where you have been previosly", or 'cd' which is "go back home". This cd() copes with that. Also when given a file name, go to the directory where this file is in. cd() { if [[ -n ${*} ]] then if [[ s${*}e == s-e ]] then builtin cd - elif [[ ! -d ${*} ]] then builtin cd "${*%/*}" else builtin cd "${*}" fi else builtin cd ~ fi ls -la }
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: