Bash Tips

SHELL CONTROLS
Ctrl l Clear screen
Ctrl a Beginning of command line.
Ctrl e End of command line.
Ctrl r Reverse search history.
Ctrl k Delete to the end of the line.
Ctrl u Delete to the beginning of the line.
Ctrl y Insert the deleted.
Ctrl _ Undo command line edit.
Ctrl p Previous command.
Ctrl n Next command.

Alt t Switches first and second word.
Alt f Forward one word.
Alt b Backward one word.
Alt d Delete forward one word.
Alt Last Argument.
!X Execute last command started with X.
!4 Repeat the 4th command in history.
!$ Last argument.
pageup First command in history

^word1^word2 Substitute word1 with word2 in previous command

COMMANDS
ls -ld */ Lists all the directories.
mv /home/user/public_html/directory1/directory2/badscript.php{,.old}

VARIABLES
echo $RANDOM gives a random number.
echo $? gives the exit status of last process executed.
echo $_ echo the last argument.
ESC . last argument

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: