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.
» 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:
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 just output your external IP, no extra characters at the end of line.
Read all chapters up to 'Jumping', improve your effectiveness of wirking in terminal.
Most useful are the Moving and Searching commands
Watches for file modifications in the current directory and tails the file.
Bulit-in function in linux, so should work on any linux distribution.
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!
#/!bin/bash
while true; do $1; sleep $2; done;
/path/to/script.sh "ifconfig eth0 | grep 'inet addr:'" 60
set colsep "&TAB" -- for tab separator
set colsep "|" -- for pipe separator
etc...
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
KISS
To get a random xkcd comic:
xdg-open http://dynamic.xkcd.com/random/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
find *.jpg
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