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 will make "secret_command" not appear in "history" list.
This exports all lines of input file as environment variables, assuming each line is like these:
Use it as bash-script.
The first positional parameter specifies the fixed length of the numerical index.
Further params specify the files to manipulate.
just an alternative to setting the size, this allows you to scroll up and see your previous commands in a given session but when you logout the history is not saved. That's the only advantage to doing it this way..
This is a useful command to backup an sd card with relative total size for piping to pv with a progressbar
set how many commands to keep in history
Default is 500
Saved in /home/$USER/.bash_history
Add this to /home/$USER/.bashrc
Not always does Xorg run on :0. For times like those, this script allows you to find out which it is.
hide your ass, buddy.
This will check if a user is logged in using ssh and will log out the user automatically after the specified time in seconds without data retrieval on the server side.
Will work with bash and zsh so put it into your sourced shell file on the server side.
Be aware that users can change this themselves as it's just a envoronment variable.
You can put this into your shell sourced file like .bashrc or .zshrc to have a different mysql prompt.
See http://dev.mysql.com/doc/refman/5.1/de/mysql-commands.html for more informations.
Beware that currently with mysql 5.5 the seconds are buggy and won't be displayed if you put this into a .cnf file. With the enironment variable this will work.
If there are spaces won't work.
# s = combine multiple lines of whitespace into 1
# x4 = set the tabstop to 4 instead of 8
# F = Exit if the output fits on 1 screen. This is similar to git diff
# R = Raw control chars. This allows you to pipe colordiff straight to less. ie: alias sdi="svn diff | colordiff | less"
# S = Chop off long lines
# X = Dont send termcap init and deinit scrings to the terminal
On systems where your home directory is shared across different machines, your bash history will be global, rather than being a separate history per machine. This setting in your .bashrc file will ensure that each machine has its own history file.
(This may be specific to bash only.) This transforms the current working directory to all uppercase characters and replaces forward slashes with backslashes, prepending the string with "C:" and appending a single ">". It serves no practical purpose, but may serve as a great practical joke if you can insert it to some victim's .bashrc :-)
usage: dng BRE [selection]
default selection is the last match
DNS is ok, but although domainnames may be easier to remember than IP numbers, it still requires typing them out. This can be error-prone. Even more so than typing IPv4 numbers, depending on the domainname, its length and complexity.
combination of several of the above
Adds a function that runs every time the prompt is rendered. The function grabs the CWD from PWD and issues a command to tmux to change the current window
when working with many machines in a computer lab need to know the IP addr is very large, this is a simplistic solution to make things easier
I was surprised to find that with RedHat bash, I could not find any comment lines (begining with #) in my bash shell history. Surprised because in Mageia Linux this works. It turns out that RedHat's bash will keep comment lines if in my .bashrc, I define:
export HISTIGNORE=' cd "`*: PROMPT_COMMAND=?*?'
Why have comment lines in shell history? It's a handy and convenient way to make proto-commands (to be completed later) and for storing brief text data that is searchable in shell history.