1. To search in history or run previous commands
This is my most used shortcut. Hit Control-R and begin to type a string.
For example, type the following and hit Enter.
grep root /etc/passwd
Then hit Control-R and begin to type 'grep'.
(reverse-i-search)`gre': grep root /etc/passwd
When you see the original command listed, hit Enter to execute it. Alternatively, you can also hit the Right-Arrow to edit the command before running it.
Use -> ctrl + r and type the command, to go one more level back again hit ctrl + r, to edit the command before you execute use right key arrow.
2. To clear the present screen use -> ctrl + l (My discovery works on board also).
3. To edit previous command using vi commands -> set -o vi
Now you can use the Vi cw command to change the word in command.
4. Use of alias
alias ll='ls -l'
alias gohome='cd; ls'
If you want these custom aliases should be available each login, add them to your .bashrc.
You can refer to command line Bible got by chance
Features in a Nutshell
- Understand the Linux desktop and various command-line parameters
- Learn filesystem navigation, file handling, and the basics of bash shell commands
- Write shell scripts to automate routine functions and reports
- Harness nesting loops and structured commands
- Monitor programs, master file permissions, and make queries
- Run scripts in background mode and schedule jobs
- Use sed, gawk, and regular expressions
- Explore all alternate shells, including ash, tcsh, ksh, korn, and zsh
This is a linux command line reference for common operations at one place.