commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
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.
You can use this to loop any command to periodically see the output.
while true; do [YOUR COMMAND HERE]; sleep [# of seconds]; done;
Alternatively, you can put it in a simple shell script to save typing!
while true; do $1; sleep $2; done;
/path/to/script.sh "ifconfig eth0 | grep 'inet addr:'" 60
Enable root user to run VLC
set colsep "&TAB" -- for tab separator
set colsep "|" -- for pipe separator
Displays only the subtotal size of a directory with the -s option, and in human readable format.
To start X11 display only on your local machine: xeyes &
Extensions to basic command: ssh -X -f user@remotehost xcalc -bg black -fg green
To get a random xkcd comic:
alias ps?='psg' for maximum hawtness. Works in bash or zsh.
there is no explicit find command in DOS you can create a batch file with this one and find all jpegs on the C drive ...
note: if creating a batch file "find.bat" the syntax changes to:
for %%f in (c) do dir %%f:\%1 /s /p
you can then use
In my job I often have to deal with moving 100,000 files or more. A mv won't do it because there are too many. This will move everything in the current directory to the target path.
This assumes your local ip starts with 192.something (e.g. 192.168), it greps ifconfig output for an ip that starts with 192, then strips the extra garbage (besides the ip)
Maybe `ifconfig | grep addr | grep Bcast` would also do it
Renames files in a directory to incremental numbers, following alphabetic order. The command does not maintain extensions.
Just type it and hit enter and you will get it.
Recursive grep through directory for file.
Easy way to find out what Debian version your machine is running
convert to debian package file (deb) a redhat package file (rpm) , then you can install it by using dpkg , require alien package ( sudo apt-get install alien first )
This find files of name like *.log and truncates them.