Today’s post will show you a list of Linux commands, tools, and tricks that I wish someone had told me about in the first place and not stopped me growing up.

Command line daily system shortcut keys

Here are some useful shortcuts that can greatly increase your productivity:

CTRL + U – Clips the content in front of 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 last space

ALT + Backspace – Deletes the previous word

CTRL + W – Cut a word after the cursor

Shift + Insert – Paste text into the terminal

So to make this easier to understand let’s look at the following line.

 sudo apt-get intall programname 
Copy the code

As you can see, there is a spelling error in the command and “intall” needs to be replaced with “install” for normal execution.

Imagine now that the cursor is at the end of the line, there are many ways to return it to the word install and replace it.

I can press ALT+B twice and the cursor will be in the following position.

sudo apt-get^intall programname 
Copy the code

Now you can press the arrow keys twice and insert “S” into Install.

If you want to copy text from the browser to the terminal, you can use the shortcut “Shift + INSERT”.

SUDO !!

If you don’t already know this command, I think you should thank me, because if you don’t know this command, you will be in agony every time you see “Permission denied” after typing a long command.

sudo !!

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

 apt-get install ranger 
Copy the code

“Permission denied” will always appear unless you have logged in to an account with high enough permissions.

sudo !! The last command is run as sudo. So the last command looks like this:

Sudo apt-get install Ranger If you don’t know what sudo is, poke here.

Pause and run the command in the background

I once wrote a guide on how to run commands in the background of a terminal.

CTRL + Z – Pause the application

Fg – Recall program to foreground

How do you use this technique?

Imagine editing a file with the Nano:

In the middle of editing the sudo nano abc.txt file, you realize you need to type some commands in the terminal right away, but the Nano running in the foreground prevents you from doing so.

You might think the only way to do this is to save the file, exit nano, run the command and then reopen Nano.

In fact, if you press CTRL + Z, the foreground command will pause and the screen will cut back to the command line. Then you can run the command you want to run, and when the command is finished, type “FG” in the terminal window to return to the previously suspended task.

One interesting attempt is to open a file with nano, type something and then pause the session. Open another file with Nano, type something and pause the session. If you type “fg” you will return to the second file opened with Nano. Only when you exit nano and type “fg” will you be returned to *** files opened with Nano.

Run commands after logging out of an SSH session using nohup

The nohup command is really useful if you are SSH to another machine.

So how do you use Nohup?

Imagine that you are using SSH to log in remotely to another computer. You run a very time-consuming command and then exit the SSH session, but the command is still executed. Nohup can make that a reality.

For example, I used my raspberry PI to download the distribution for testing purposes. I would never give my raspberry PI an external monitor, keyboard or mouse.

I always use SSH to connect to raspberry PI from my laptop. If I download large files using raspberry PI without Nohup, I have to wait until the download is complete before I can log out of an SSH session to shut down my laptop. But if that’s the case, then why am I using raspberry PI files?

Using nohup is also as simple as entering the command to execute after nohup as shown in the following example:

Nohup wget inuxmint http://mirror.is.co.za/mirrors/linuxmint.com/iso//stable/17.1/l - 17.1 - cinnamon - 64 - bit. Iso &Copy the code

Run Linux commands’ at ‘specific times

The nohup ‘command is useful when you are SSH connected to the server and keep performing SSH pre-logout tasks on it.

What if you needed to execute the same command at a specific time?

The command ‘at’ will do the job. Here is an example of the use of ‘at’.

At 10:38pm Friat> cowsay ‘hello’ at> CTRL + D the command above can run cowsay on Friday at 10:38pm.

The syntax used is’ at ‘followed by the date and time. When the AT > prompt appears, enter the command you want to run at that time.

CTRL + D returns to terminal.

There are also many date and time formats that require you to dig through the MAN manual of ‘at’ to find more.

Man manual

The Man manual will give you an outline of commands and parameters and teach you how to use them. The Man manual looks dull. (They’re not designed to entertain us, I suppose).

But that doesn’t mean you can’t do something to make them look better.

Export PAGER=most You need to install ‘most’; She will add color to your man manual.

You can set the specified line for the MAN manual using the following command:

Export MANWIDTH=80 ***, if you have an available browser, you can use -h to open any man page in the default browser.

Man-h note that this command only works if you set the default BROWSER to the $BROWSER environment variable.

Use hTOP to view and manage processes

Which command do you use to find out what process is running on your computer? I bet it’s ‘PS’ and add different parameters after it to get the different output you want.

Install ‘htop’! It’s gonna make you want to see it.

Htop presents processes as a list on the terminal, similar to the Task manager in Windows. You can use the combination of function keys to switch the arrangement and the items displayed. You can also kill processes directly in hTOP.

Simply enter htop in the terminal to run.

htop

Browse file systems using Ranger

If Htop is good for command-line process control, Ranger is good for command-line file system browsing.

You may need to install it before you can use it, but once it’s installed you can start it by typing the following command line:

Ranger ranger is similar to some other file managers in the command line window, but it is left to right rather than up to down, which means that pressing the left arrow key will take you to the previous folder, and the right arrow key will switch to the next.

The Ranger man manual is worth reading before you use it so you can use the shortcut keys to operate ranger.

Cancel shutdown

Either on the command line or in a GRAPHICAL user interface, you realize you don’t really want to shut down.

Shutdown -c Note that it may not be enough time to stop the shutdown if the shutdown has already started.

Here’s another command to try:

pkill shutdown
Copy the code

Simple way to kill a pending process

Imagine that the application you’re running dies for no apparent reason.

You can use ‘ps-ef’ to find the process and kill it or use ‘htop’.

There is a faster and easier command called Xkill.

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

Xkill what happens if the whole system fails?

Hold ‘Alt’ and ‘sysrq’ on your keyboard and slowly type the following keys:

REISUB

This will restart your computer without pressing the power button.

Download Youtube video

In general, most of us enjoy watching Youtube videos and streaming Youtube on our favorite player.

If you need to be offline for an extended period of time (e.g., flying from southern Scotland to southern England) then you may want to download some videos to a storage device to watch at your leisure.

All you have to do is install youtube-dl from package manager.

You can use youtube-dl with the following command:

 youtube-dl url-to-video
Copy the code

You can click the share link on the Youtubu video page to get the URL of the video. Simply copy the link and paste it into the command line (shift + INSERT).

conclusion

Hopefully you found some help in this article, and found at least one of these 11 tricks that made you go “Wow, that’s how it works”.

Scan the qr code below and ask me to pick up the 20GB Exquisite Linux video course