I have spent a decade of Linux, today through this article I will show you a series of commands, tools and techniques, I hope the beginning I was told that, instead of snagging I had on my growth path .
1. command-line-based daily Shortcuts
The following useful shortcuts that can greatly enhance your productivity:
CTRL + U - Cut content before the cursor
CTRL + K - content cursor to the end of the cut line
CTRL + Y - Paste
CTRL + E - move the cursor to the end of the line
CTRL + A - Move the cursor to the beginning of the line
ALT + F - jump to the next space
ALT + B - jumps on a space
ALT + Backspace - Delete the previous word
CTRL + W - after cutting the cursor one word
Shift + Insert - to paste text into the terminal
To make it easier to understand the above point of view the following command line.
sudo apt-get intall programname
As you can see, the command is misspelled need for proper implementation of "intall" replaced by "install".
Now imagine the cursor is at the end of the line, we have a lot of ways to install and replace the word she returned it.
I can press ALT + B twice so that the cursor will be in the following position (used here to refer to the position of the cursor).
sudo apt-get ^ intall programname
Now you can double-click the arrow keys and the "s" is inserted into the install went.
If you want to copy the text in the browser to the terminal, you can use the shortcut key "shift + insert".
2. SUDO !!
If you do not know this order, I think you should have a good thank me, because if you do not know, then every time you see the "permission denied" will be painful after entering a long string of commands.
How to use sudo !!? Very simple. Imagine you just enter the following command:
apt-get install ranger
Will appear "Permission denied", unless you are already logged sufficiently high privilege account.
sudo !! will run on a form sudo command. So on a command becomes this:
sudo apt-get install ranger
If you do not know what is sudo, poke here.
3. Pause and run commands in the background
I once wrote a guide on how to run the command in a terminal background.
CTRL + Z - to suspend the application
fg - will again call the program to the foreground
How to use this trick it?
Imagine you are editing a file with nano:
sudo nano abc.txt
File Editor half you realize you need to immediately enter these commands in a terminal, but nano running in the foreground so that you can not enter.
You may think that the only way is to save the file and exit nano, run the command after you reopen the nano.
In fact, you just press CTRL + Z, the reception of the command will be suspended, the screen will switch back to the command line. Then you can run the command you want to run, run after commands in a terminal window, enter "fg" can return to a previously suspended task.
There is a very interesting attempt to open a file is to use nano, type something and then suspended the session. Nano and then open another file, and then suspended the session to enter some what. If you enter "fg" you will be back with a nano second to open the file. Only exit nano enter "fg", you will return to the first open file with nano.
4. Use the nohup after logout SSH session is still running the command
If you use ssh to other machines, nohup command is really useful.
So how to use nohup it?
Imagine that you use ssh remote login to another computer, you run a very time-consuming command and then quit the ssh session, but the command is still being executed. The nohup this scenario can become a reality.
For example, because of the need to test, I sent my raspberry download release. I absolutely will not give me the raspberry pie external monitor, keyboard or mouse.
Usually I always connect from the laptop to the raspberry pie with SSH. If I use Raspberry Pi download large files without the use nohup, then I have to wait until after the download is complete, turn off the notebook to logout ssh session. But if so, then why should I use Raspberry Pi next document?
Use nohup method is also very simple, for example, enter the command to be executed just after nohup can be as follows:
nohup wget http://mirror.is.co.za/mirrors/linuxmint.com/iso//stable/17.1/linuxmint-17.1-cinnamon-64bit.iso &
5. Run 'in the' particular time Linux command
'Nohup' command you use SSH to connect to the server and execute the above holding time SSH log out before the task is very useful.
Think about if you need to execute the same command at a specific time, this situation is how to do it?
Command 'at' can properly resolve this situation. The following are the 'at' the use of examples.
at 10:38 PM Fri
at> cowsay 'hello'
at> CTRL + D
The above command to run the program cowsay Friday 22:38.
The syntax is used after the 'at' append the date and time. When at> prompt appears after you can enter the time you want to run the commands.
CTRL + D return to the terminal.
There are many date and time format, you need to take to double 'at' the man manual to find more use.
6. Man Manual
Man's manual will list for you to use the outline commands and parameters, to teach you how to use them. Man looks dull dull manual. (I do not consider that they are designed to entertain us).
But this does not mean you can not do to make them become prettier.
export PAGER = most
You need to install the 'most'; she will make you your man manual colors more brilliant.
You can give man manual setting designated governor with the following command:
export MANWIDTH = 80
Finally, if you have a browser available, you can use any of -H open in the default browser man page.
Pay attention to you, the above command only in your default browser is set to the environment variable $ BROWSER in effect until after yo.
7. Using htop to view and manage processes
Which command you use to find out the process on a computer that is running it? I bet the 'ps' and subsequently adding different parameters to get what you want different output.
Installation 'htop' it! Absolutely let you met earlier.
htop at a terminal in the process by way of a list presented, somewhat similar to the Windows Task Manager. You can use a combination of function keys to switch arrangement and the items displayed. You can also directly kill the process htop.
In the terminal simply type htop to run.
8. ranger browse the file system
If htop is a good helper for command-line process control, the ranger is the command line to browse the file system is a good helper.
You may need to be installed before use, but you can enter the following command to start her command Once installed:
In the command line window ranger and some other file manager like, but compared to the upper and lower structural layout, she is about the structure, which means that you press the left arrow key you will advance to a folder, and right arrow keys it will switch to the next.
The man ranger before use manual or worth reading, so you can use the shortcut keys ranger.
9. cancel shutdown
Either the command line or a graphical user interface turned off, only to find that they are not really want to shut down.
It should be noted that, if the shutdown has begun is likely too late to stop the shutdown.
The following is another command you can try:
10. The simple way to kill hung process of
Imagine the application you are running the dead of unknown causes.
You can use the 'ps -ef' to find after killing the process or use the 'htop'.
There is a faster, easier command is called xkill.
Simply enter the following command in a terminal window and click on the application you want to kill.
What if the whole system hang up how to do it?
Press and hold on the keyboard 'alt' and 'sysrq' button, then slowly enter the following keys:
So do not press the power button on your computer can restart.
11. Download Youtube Video
In general most of us like to watch Youtube videos will play Youtube streaming through favorite player.
If you need some time off (for example: by plane from southern Scotland to southern England travel this time) then you might want to download some video to the storage device, when the leisure to watch.
You have to do is install youtube-dl from the package manager.
You can use the following command youtube-dl:
You can click on the link to get to share video url in Youtubu video page. Simply copy and paste the link to the command line on the line (use shift + insert shortcut yo).
to sum up
I hope you get help in this article, and found 11 in at least one make you wonder "original can" technique.