Linux system 11 terminal commands that cannot be known

  

There are a lot of terminal commands under Linux system. In fact, these commands can be regarded as shortcut keys. If you know these commands, using a Linux system will undoubtedly become more convenient. This article will introduce the Linux system 11 terminal commands that you can't help but know.

1. Command Line Daily shortcuts

The following shortcuts very useful system, can greatly enhance your productivity:

CTRL + U - Cut the content before the cursor

CTRL + K - Cut the cursor to the end of the 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 - Jump back to the previous space

ALT + Backspace - delete the previous word

CTRL + W - cut a word after the cursor

Shift + Insert - paste the text into the terminal

then to make the above easier Understand the following line of commands.

sudo apt-get intall programname

As you can see, there are spelling errors in the command, and you need to replace “intall" with “install” for normal execution.

Imagine that the cursor is now at the end of the line, we have a lot of ways to return her to the word install and replace it.

I can press ALT+B twice so the cursor will be in the following position (here the position of the cursor is used).

sudo apt-get^intall programname

Now you can press the arrow key twice and insert “s” into the install.

If you want to copy the text from your browser to the terminal, you can use the shortcut "ldld;shift + insert".

2. SUDO! !

If you don't know this command yet, I think you should thank me very much, because if you don't know, then every time you see a long string of commands, you will see pain after seeing "permission denied" Unbearable.

sudo ! !

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

apt-get install ranger

"Permission denied" will occur unless you have logged in to a sufficiently high-privileged account.

sudo ! ! The previous command will be run in the form of sudo. So the previous command becomes like this:

sudo apt-get install ranger

If you don't know what sudo is, poke it here.

3. Pause and run commands in the background

I have written a guide on how to run commands in the background of the terminal.

CTRL + Z - Pause the application

fg - Re-call the program to the foreground

How to use this trick?

Imagine that you are editing a file with nano:

sudo nano abc.txt

Halfway through the file editing, you realize that you need to enter some commands at the terminal right away, but nano Running in the foreground makes you unable to type.

The only way you might think is to save the file, exit nano, and re-open the nano after running the command.

In fact, you just press CTRL + Z, the foreground command will be paused, and the screen will be cut back to the command line. Then you can run the command you want to run, and when the command is finished running, type "ldg" in the terminal window to return to the previously suspended task.

It's very interesting to have a try to open a file with nano, type something and pause the session. Then use nano to open another file, enter something and then pause the session. If you type “fg” you will return to the second file opened with nano. You can only go back to the first file opened with nano by exiting nano and entering “fg”.

4. Use nohup to run commands after logging out of an SSH session

The nohup command is really useful if you use ssh to log in to another machine.

So how do you use nohup?

Imagine using ssh to remotely log in to another computer. You ran a very time-consuming command and then quit the ssh session, but the command is still executing. And nohup can turn this scene into reality.

For example, because of the need for testing, I used my Raspberry Pi to download the distribution. I will never send an external monitor, keyboard or mouse to my Raspberry.

I usually use SSH to connect to the Raspberry Pi from my laptop. If I use the Raspberry Pi to download large files without nohup, then I have to wait until the download is complete before I can log out of the ssh session and turn off the notebook. But if so, why should I use the Raspberry Pi file?

The method of using nohup is also very simple. Just type the command to be executed after nohup in the following example:

nohup wget http://mirror.is.co.za/Mirrors/linuxmint.com/iso//stable/17.1/linuxmint-17.1-cinnamon-64bit.iso &

5. ‘Run Linux commands at a specific time

&lsquo The nohup’ command is useful when you are using SSH to connect to the server and keep performing SSH login tasks.

Think about what to do if you need to execute the same command at a specific time.

The command ‘at’ will solve this situation properly. Here's an example of ‘at’

at 10:38 PM Fri

at》 cowsay ‘hello’

at CTRL + D

The above command will be available on Friday afternoon Run the program cowsay at 10:38.

The syntax used is ‘at’ appended date and time. When the at prompt appears, you can enter the command you want to run at that time.

CTRL + D returns to the terminal.

There are also many date and time formats that require you to flip through the <at’ man manual to find more ways to use it. Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved