Commands by asmoore82 (10)

What's this? 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

Do some learning...
no loop, only one call of grep, scrollable ("less is more", more or less...)

Renaming a file without overwiting an existing file name
Sometimes in a hurry you may move or copy a file using an already existent file name. If you aliased the cp and mv command with the -i option you are prompted for a confirmation before overwriting but if your aliases aren't there you will loose the target file! The -b option will force the mv command to check if the destination file already exists and if it is already there a backup copy with an ending ~ is created.

Uptime in minute
Want to run scripts/programs in the system after starting X minute [ For letting the system to free ]? This will give uptime in minute.

Insert the last command without the last argument (bash)
$/usr/sbin/ab2 -f TLS1 -S -n 1000 -c 100 -t 2 then $!:- is the same as $/usr/sbin/ab2 -f TLS1 -S -n 1000 -c 100 -t 2

Output Windows services in a neatly formated list (cygwin)
Outputs Windows Services service name and display name using "sc query", pipes the output to "awk" for processing, then "column" for formatting. List All Services: $ sc query state= all | awk '/SERVICE_NAME/{printf"%s:",$2;getline;gsub(/DISP.*:\ /,"");printf"%s\n",$0}' | column -ts\: List Started Services: $sc query | awk '/SERVICE_NAME/{printf"%s:",$2;getline;gsub(/DISP.*:\ /,"");printf"%s\n",$0}' | column -ts\: List Stopped Services: $sc query state= inactive| awk '/SERVICE_NAME/{printf"%s:",$2;getline;gsub(/DISP.*:\ /,"");printf"%s\n",$0}' | column -ts\:

Insert the last command without the last argument (bash)
$/usr/sbin/ab2 -f TLS1 -S -n 1000 -c 100 -t 2 then $!:- is the same as $/usr/sbin/ab2 -f TLS1 -S -n 1000 -c 100 -t 2

calculate the total size of files in specified directory (in Megabytes)
the command will calculate the size of hidden files

Using vim to save and run your python script.
This will save and execute your python script every time your press the F5 function key. It can also be added to your .vimrc: autocmd BufRead *.py nmap :w^M:!python % NOTE: the ^M is not just caret-M, it can be created by type: ctrl-v ctrl-m

list files in mtime order
Simple but useful; list files in the current directory in mtime order. Useful if you've been working on something and then take a day or two off.

download newest adminer and rename to it's version accordingly
If the version already downloaded. it will not download again

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.


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: