备份文件
cp install_collectd.log{,-old}
备份恢复
mv /etc/rc.conf{-old,}
重命名文件
mv /path/to/file.{txt,xml}
批量生成文件夹
mkdir myfolder{1,2,3}
光标移动到行首行尾
Ctrl+AandCtrl+E
删除光标前光标后,删除光标前的单词
Ctrl+U Ctrl+K Ctrl+W
搜索历史命令
Ctrl+R
回到上次目录
cd -
回到用户目录
cd ~
if you run a command that needs root privileges but forget to addsudoto the beginning, there's no need to retype the command. Just run:
sudo !!
if you want to run the last command that usedcat, you could just type:
!cat
If you just want to see what the lastcatcommand was, you can instead run:
!cat:p
say you had just created a folder using:
mkdir /new/awesome/folder
To thencdinto that directory, you could just type:
cd !$
Ctrl+LClear the screen
tabTab key autocomplete the name of command/file/directory etc. For eg. typetouand type tab
UP ARROW KeyShows you previous command in descending order
DOWN Arrow KeyWhen you are usingUP ARROW Keyto get previous command.Then try thisDOWN Arrow,it will show forward command history
Ctrl+RIt is for Reverse search.Press CTRL+R and type some command which you last run.It will search for last command you run.
Here we pressed CTRL+r then typed /etc ,it automatically searched for command
(reverse-i-search)`/etc': /etc/init.d/httpd restart
Ctrl+JIt end the CTRL+r search
Ctrl+GIt abort the search by CTRL+r ( and restores original line)
CTRL+pIt shows previous history,same like UP arrow key
CTRL+nIt shows forward history,same like DOWN arrow key
Ctrl+BMove cursor one character to the left side
Ctrl+FMove cursor one character to the right side
Ctrl+AMove cursor to start of the line
Ctrl+EMove cursor to end of the line
HOMEMove cursor at the start of the line
ENDMove cursor at the end of the line
CTRL+ RIGHT ARROWMove cursor one word right hand side
CTRL + RIGHT ARROWMove cursor one word left hand side
Ctrl+UIt cut everything from the line start to cursor
Ctrl+KIt cut everything from the cursor to end of the line
Ctrl+WIt cut the current word before the cursor
Ctrl+YIt paste the previous cut text
CTRL+kIt cut the line from the position of the cursor to the end of the line.
CTRL+SHIFT+cTo copy selected text
CTRL+SHIFT+vTo paste you last copied by CTRL+SHIFT+c
SHIFT + INSERTCopy selected text to clipboard and paste from the clipboard
Shift+PgUp/PgDown It Scrolls console buffer up/down. You can use this key, also in Runlevel 3 or terminal mode
CTRL+zPut the running process in background.(To get back, runjobscommand.And then foregorund it by usingfgcommand. )
For example. First run thetopthen press CTRL+z.After this use fg command and found job no. 1 for top. See below example
linux@tuxworld:~/Desktop$jobs[1]+Stoppedtoplinux@tuxworld:~/Desktop$fg%1
Ctrl + TIt swap the last two characters before the cursor
Esc + TIt swap the last two words before the cursor
CTRL+mIt is like a Enter key (If ENTER key do not work,try this)
And at the end….
Ctrl + DLog out of current session, likeexitcommand