This note is protected by password and is a Read Only.

Basic Keyboard Shortcuts

Up/Down Arrows:
The up and down arrows on your keyboard move through your last used commands. So, if you wanted to run the second to last command you ran, just hit the up arrow twice and hit Enter. You can also edit the command before you run it.

Ctrl+Left and Ctrl+Right or Esc+B and Esc+F:
Hitting Ctrl and the left or right arrow keys jumps between arguments in your command. So, if you had a typo in the middle of the command, you could jump to it quickly with Ctrl and a few taps of the left arrow key. Note that on Mac OS X and Windows, this shortcut is Esc+B and Esc+F instead. This is pretty awkward, but OS X users can change it from the Terminal's preferences if they so choose.

Ctrl+U:
This clears the entire line so you can type in a completely new command.

Ctrl+U:
This clears the entire line so you can type in a completely new command.

Ctrl+K:
This deletes the line from the position of the cursor to the end of the line.

Ctrl+W:
This deletes the word before the cursor only.

Ctrl+R:
This lets you search your command history for something specific. For example, if you wanted to search for the recent commands that included nano, you would hit Ctrl+R and type nano. It would show your most recent command, and you could use the up and down arrows to cycle through your history of commands using nano in them.

Tab:
One of everyone's favorite shortcuts employs Tab to autocomplete a line of text. So, say you wanted to type cd ~/Dropbox/, you could just type cd ~/Dr, hit Tab to autocomplete opbox, and continue on with your day.

cd - :
Moves you back to the last working directory.

!! :
One of the most useful shortcuts is using !! to represent the last command you ran. This is useful in a ton of situations. For example, if you run a command that needs root privileges but forget to add sudo to the beginning, there's no need to retype the command. Just run: sudo !!

!$ :
If you want to run a different command that you ran last, but with the same argument, there's a shortcut for that too. For example, say you had just created a folder using:
mkdir /new/awesome/folder
To then cd into that directory, you could just type:
cd !$
The !$ represents the arguments from your last command.

^abc^abd :
Say you wanted to run nano, but accidentally typed nanp: nanp /path/to/a/document/buried/deep/in/the/filesystem Instead of retyping the whole thing, you could just run: ^nanp^nano This will find the first instance of nanp in the last run command and replace it with nano.

history :
istory command is your friend. If you want to see all the recent commands you ran that included nano, for example, you could just run:
history | grep nano
381 sudo nano /etc/NetworkManager/nm-system-settings.conf
387 sudo nano /etc/rc.conf
388 sudo nano /etc/rc.conf
455 sudo nano /boot/grub/menu.lst
You can then pick a command out from that list—say I want to run sudo nano /boot/grub/menu.lst, which grep lists as command 455—and run it using: !455
Lastly, if you want to keep certain commands out of your history, just put a space before them—i.e. space+nano ~/Documents/WorldDominationPlans.txt.

{} :
When you're working with variations of a file—like backups or different file types—it can get tedious typing out the same commands with small tweaks. Using the brace symbols ({}), you can easily perform batch operations on multiple versions of a file.

Say you want to rename just part of a filename. Instead of typing out mv /path/to/file.txt /path/to/file.xml, you could just run:
mv /path/to/file.{txt,xml}
This runs the command with the same arguments, only with the parts inside the brace changed—the first part corresponding to the first argument, the second part corresponding to the second argument.

The most common example of this is when you're backing up a file that you're making changes to. For example, if you are tweaking your rc.conf, you'll want to make a backup in case the new one doesn't work. So, to do so, you can just run:
sudo cp /etc/rc.conf{,-old}
Putting nothing before the comma will just append -old to the filename after copying it with cp. If your new file doesn't work out and you want to restore the backed up file to its original location, you can just use:
sudo mv /etc/rc.conf{-old,}
Moving the comma to the other end of the brace will remove -old from the end of the file and restore it to its original name.
The braces can also work when moving or creating multiple files at once. For example, if you wanted to create three numbered directories, you could just run:
mkdir myfolder{1,2,3}
This will create three folders: myfolder1, myfolder2, and myfolder3.


None Private Note List:

URL Note Summary Days before delete
AllowedHtml <ul> <li><br> - Line break.</li> <li><o... 30137
BigDataFishig <b>#RealTimeData + #BigData + #Fishing</b>...teach... 30975
ChatSample Lee: Hello there, so can you explain how to chat u... 30137
Command-Line-Shortcuts <h3>Basic Keyboard Shortcuts</h3><b>Up/Down Arrows... 30223
dba <h2 style="display: inline;">Timeline:</h2> 21-Ja... 30166
dst_upgrade <h1>Oracle 11.2.0.2 DST Upgrade</h1><ol><li><b>che... 30201
Feedback ... 30081
hadoop_class_at_ebay eBay's North Campus, Parley room 2161 N. First ... 30260
mysql Get the size of a MYSQL Dababase: [code]SELECT ta... 30136
outlook-meeting-assassin <h1>Outlook Meeting Assassin</h1>A Simple Outlook ... 30695
Programming-Quotes <h3>Programming Quotes</h3> “ Java is to JavaScri... 30223
scrum <h2 style="margin: 0px 0px 0px 0px; padding: 0px 0... 867
vi <h2>vi cheat sheet</h2><b><u>Starting & ending com... 30142
websiteTricks-transperent [code]<!-- div.background { width:500px; h... 30081
xdb_installation <h1>Oracle XML DB (XDB) Installation</h1><ol> <li... 30201
zzzzzzzzzzz whycghkghfjjfhkctshsaqzmypqgrehghtmfggfhgoygvfjknm... 652

What else can I do with this?