11 Linux Terminal command, never used and go try it! !

By this article today I will show you a series of commands, tools and techniques, and I hope the beginning someone had told me, rather than I had caught me on the growth path.

1. Department of shortcuts Command Line Daily

The following shortcuts are useful, can greatly enhance your productivity:

 

 

To make it easier to understand the above point of view the following command line.

1sudo apt-get intall programname

As you can see, the command is misspelled need for proper implementation of the "intall" replaced by "install".

Now imagine being the end of the cursor line, we have many ways to install and replace the word she returned it.

I twice ALT + B so that the position of the cursor will be in the following (herein refer to the position of the cursor).

1sudo 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 text to the browser in the terminal, you can use shortcut keys "shift + insert".

2.SUDO !!

If you do not know this order, I think you would do well to thank me, because if you do not know, then every time you see the "permission denied" will definitely painful after entering a long string of commands.

How to use sudo !!? Very simple. Imagine you just enter the following command:

1apt-get install ranger

Certain "Permission denied", unless you are already logged enough high-privilege account will appear.

sudo !! will run on the form of a sudo command. So the previous command becomes this:

1sudo apt-get install ranger

( Warning! Home Jun strongly against the use of this command, as if on command in case there are some clerical error or mistake you which one is on a command, it is possible that the consequences are disastrous! So, do not To execute this command! Do not execute this command! Do not execute this command! the important thing is repeated three times. )

3. Pause command and run in the background

CTRL + Z - to suspend the application

fg - re-program call to the front desk

How to use this technique it?

Imagine you are editing a file with nano:

File editing you realize you need to half immediately enter these commands in the terminal, but nano running in the foreground so that you can not enter.

You may think the only way is to save the file and exit nano, nano re-open after running the command.

In fact, you just press CTRL + Z, the front desk will pause command, the screen will switch back to the command line. Then you can run the command you want to run, run commands in a terminal window after input "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, enter some what then pause the session. 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 use nano open file.

4. Use the nohup command is still running after logout SSH session

If you log on other machines using ssh, nohup command is really useful.

So how to use nohup it?

Imagine you log on to another computer remotely using ssh, you run the command a very time-consuming 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 used my raspberry sent to download the release. I absolutely will not give me the raspberry pie external monitor, keyboard or mouse.

I usually always connected from the laptop to the raspberry pie with SSH. If I use a raspberry pie download large files without the use of nohup, then I would have to wait until the download is complete, logout ssh session to turn off the notebook. But if so, then why should I use Raspberry Pi case file it?

Use nohup method is also very simple, just as in this example an input command to be executed after nohup to:

The specific time run 'in (at)' Linux command

'Nohup' command you connect to the server using SSH, execute and keep on top of SSH out the task before time is useful.

Think about if you need to execute the same command at a specific time, this situation how to do it?

Command 'at' will be able to properly resolve this situation. The following are 'at' uses examples.

 

 

The above command can run the program cowsay at 10:00 Friday afternoon 38 points.

The syntax is used after the 'at' additional date and time. When after the at> prompt appears you can enter commands you want to run at that time of the.

CTRL + D return to the terminal.

There are many date and time format, you need to take to double 'at' man pages to find more use.

6.Man manual

Man Manual lists the commands and parameters using the outline for you, teach you how to use them. Man Manual looks dull dull. (I do not consider that they are designed to entertain us).

But this does not mean you can not do anything to make them become prettier.

1export PAGER=most

You need to install the 'most'; she will make you a man of your manual for more brilliant colors.

You can give man manual setting designated governor with the following command:

1export MANWIDTH=80

Finally, if you have a browser available, you can use any of -H open in the default browser in man pages.

1man -H 

Pay attention to you, more than you will command only in the default browser settings to effect only after $ BROWSER environment variable in the yo.

7. Using htop to view and manage processes

You find out the process running on your computer with which command it? I bet a 'ps' and subsequently to add different parameters to get what you want different output.

Installing 'htop' it! Absolutely let you met earlier.

htop way of presenting a list of processes in the terminal, somewhat similar to the Windows Task Manager. You may use a combination of function keys arranged in a manner to switch out and display items. You can also directly kill processes in htop.

In a simple input terminal to run htop.

Lhtop

8. Use ranger browse the file system

If htop command-line process control is a good helper, then 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 on the command line Once installed the following command to start her:

1ranger

In the command line window ranger and some other file manager like, but down compared to the structure and layout, she is about structure, which means that you press the left arrow key will advance you to the previous folder, and right arrow keys it will switch to the next.

In man manual before using the ranger still worth reading, so you can use the shortcut keys ranger.

9. cancel shutdown

Whether in the command line or a graphical user interface is shut down, only to find that they are not really want to shut down.

1shutdown -c

It should be noted that, if the shutdown is likely to have started too late to stop the shutdown.

The following is another command you can try:

1pkill shutdown

10. The simplest way to kill the suspended process

Imagine the application you are running a reason unknown dead.

You can use the 'ps -ef' kill or be found using the 'htop' after the process.

There is a faster, easier command is called xkill.

Simply enter the following command in the terminal and click on the application you want to kill in the window.

1xkill

What if the entire system hung up how to do it?

Press and hold the keyboard 'alt' and 'sysrq' button, then slowly enter the following key:

1REISUB

So do not press the power button on your computer can restart.

11. Download Youtube Videos

In general most of us like to watch Youtube video, will play streaming media via Youtube favorite player.

If you need offline for a period of time (for example: by plane from southern Scotland to southern England this time travel) then you might want to download some videos to the storage device, to watch leisure time.

You have to do is install youtube-dl from the package manager.

You can use the following command youtube-dl:

1youtube-dl url-to-video

You can click on the link to get the video url to share in Youtubu video page. Simply copy and paste the link in to the command line on the line (use shift + insert shortcuts yo).

to sum up

I hope you get help in this article, and found that 11 of the at least one make you wonder, "the original can be" skills.

Guess you like

Origin blog.csdn.net/sinat_38682860/article/details/94587554