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:
This alias is meant to append n (here is n=10) most recently used cd commands to the bottom of history file. This way you can easily change to one of previous visited directories simply by hitting 1-10 times arrow up key.
Hint: You can make more aliases implying the same rule for any set of frequently used long and complex commands like: mkisof, rdesktop, gpg...
Put the function in your .bashrc and use "map [alias]" to create the alias you want. Just be careful to not override an existing alias.
Syntax:
google query_with_spaces "
so, make sure to end your query with a double quote
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
it's a mixed environment where I work, and since we still use WINS services, this is often a quick and dirty way for me to obtain a mac-address for a hostname. please note that nmblookup is part of the samba suite. Just another one of those nearly useless commands that is super cool when and only when you need it.
1. Get name of task by task=$(basename "$(pwd)")
2. Check whether "$task.c" exists as a file
3. open "$task.c", "$task.in", "task.out" in vim with such layout.
-------------------------------
| | $task.in |
| | |
|$task.c |-----------------|
| | $task.out |
| | |
-------------------------------
Personally I think line wrap in default df command is annoying for scripting & seeing. So I overwrite it. Maybe more work should be done if wrapped line is over 2...
alias for psql command line; works similar for Oracles sqlplus commandline interface.
if you do not provide stdin you will end up in the db shell.
When setting up a new aliases file, or having creating a new file.. About every time after editing an aliases file, I source it. This alias makes editing alias a bit easier and they are useful right away. Note if the source failed, it will not echo "aliases sourced".
Sub in vi for your favorite editor, or alter for ksh, sh, etc.
This is for bash - make an alias - also a good blueprint for making aliases that take arguments to functions. If for Solaris use "-size +${1}000000c" to replace "-size +${1}M"
This alias is quicker to type than 'sudo apt-get install', and it automatically says yes to the prompt that shows up sometimes.
Sets an alias to remote desktop to the specified console, along with options to ensure the RDP session takes up the whole screen, includes a home directory mapping, and clipboard mappings.
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.
I often use it at my work, on an ovh server with root ssh access and often have to change mod after having finished an operation.
This command, replace the user, group and mod by the one required by apache to work.
Terminal is part of XFCE Desktop. This will open a tab for every node that we pass in the command line. In a single line we'll connect to nodes of our server farm.
This is an attempt to get a command which I can alias. It's ugly but it works. I'm hoping someone can suggest a cleaner version.
I have tried....
# alias kfire="for i in $( ps aux | grep [F]irefox | awk \'{print $2}\' ); do kill $; done"
# alias kfire=`kill $(ps aux | grep [F]irefox | awk '{print $2}' | tr '\n' ' ')`
# alias kfire='ps au | grep -i [F]irefox | awk \'{ print $2 \'} '
and they all fail in a .bashrc I've tried escaping the quotes and can't find a way to make the single quotes ' that awk wants work. Maybe I'm just stubborn but I don't want to put in a little #!/bin/bash file just so I can kill a firefox process all in one stroke. This script works (it kills the process before it errors out)... it's just ugly and there may be a pretty way to do this.
Would create a file with a meaningful title. Dedicated to John Cons, who is annoying us users. Merry Christmas!!!
Bash alias for easy irssi within screen, attempts to attach to existing irssi session, if one exists, otherwise creates one - Including wipe for when system reboots and leaves "dead" session.