Here is another way to show the path, one directory per line. The command `tr` translates the colon into the new line, taking input from the $PATH variable Show Sample Output
The Linux's `cal` command is nice, but there are times when I need to see two months side by side and this command will do it. Show Sample Output
I put this line in my ~/.bashrc file (which I source via ~/.bash_profile). Now, when I need to install a package, I typed *install* instead of the longer version.
I often use this command to learn pronunciation of unfamiliar words.
This is useful for examining the path. Show Sample Output
I use this command to start a local Python document server over HTTP port 8888.
I often run some command that takes a while to finish. By putting the say command afterward, I get an audio notification. Please note that this command (say) only works on Mac OS X and not Linux.
Curious about differences between /bin, /usr/bin, and /usr/local/bin? What should be in the /sbin dir? Try this command to find out. Tested against Red Hat & OS X
I use this command (PS1) to show a list bash prompt's special characters. I tested it against A flavor of Red Hat Linux and Mac OS X Show Sample Output
Usage:
mydir=/very/long/path/to/a/dir
cd mydir
I often need to cd where no man wants to go (i.e. long path). by enabling the shell option cdable_vars, I can tell cd to assume the destination is the name of a variable.
If you omit the function name, the command will display all definitions Show Sample Output
If you issue the "set" command, you'll see a list of variables and functions. This command displays just those functions' names. Show Sample Output
I often need to extract a function from a bash script and this command will do it. Show Sample Output
For example, if you are the type who type ls very often, then
PROMPT_COMMAND=ls
will ls after every command you issue.
Place this in your .bash_profile and you can use it two different ways. If you issue 'h' on its own, then it acts like the history command. If you issue:
h cd
Then it will display all the history with the word 'cd'
I often need to know of my directory in the PATH, which one DOES NOT exist. This command answers that question * This command uses only bash's built-in commands * The parentheses spawn a new sub shell to prevent the modification of the IFS (input field separator) variable in the current shell
I have a directory containing log files. This command delete all but the 5 latest logs. Here is how it works: * The ls -t command list all files with the latest ones at the top * The awk's expression means: for those lines greater than 5, delete.
This command displays a simple menu of file names in the current directory. After the user made a choice, the command invokes the default editor to edit that file. * Without the break statement, the select command will loop forever * Setting the PS3 prompt is optional * If the user types an invalid choice (such as the letter q), then the variable $f will become an empty string. * For more information, look up the bash's select command Show Sample Output
This command displays a list of lines that are longer than 72 characters. I use this command to identify those lines in my scripts and cut them short the way I like it.
The curl command retrieve the HTML text containing the IP address. The grep command picks out the IP address from that HTML text. Show Sample Output
This is one way to find out. Show Sample Output
This is a simple command for jumping to the matching brace, square bracket, or parentheses. For example, it can take you from the beginning of a function to the end with one key stroke. To delete everything between the pairs of {}, [], or (), issue the command:
d%
To replace text between pairs of braces, brackets, or parentheses, issue the command:
c%
You can also use this command to find out if an opening brace has been properly closed.
Retrieve the current stock price from Yahoo Finance. The output is simply the latest price (which could be delayed). If you want to look up stock for a different company, replace csco with your symbol. Show Sample Output
commandlinefu.com 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.
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: