Basics of Using the Linux Command Line : Important Keyboard Shortcuts

Basics of Using the Linux Command Line

For the data scientist programmer, deployment phase is very headache to them. They have an idea of how to build machine learning models, deep learning model and how to run these models on the localhost. But when they want to deploy these models they fail. Most of the servers you found online don’t have a control panel or GUI(Graphical User Interface). You have to do most of the work on the command line thus its very important that you should learn the basics of the command line argument to become more fluent in programming. In this tutorial, you will learn the basics of Using the Linux Command Line in the Linux operating system. I am doing all the command lines on the Ubuntu terminal for education purpose. All these commands will be the same for every Linux operating system whether it Fedora, Redhat or any cloud server.

How commands are Structured?

The general patterns of all the Linux commands are command then options then arguments. It means like this “command” “options” “arguments”. The command and the arguments are compulsory to write for the command prompt or terminal to give output. The option is optional. However, Options tell the command prompt how to operate the command. Most of the command options start with a dash and are usually one letter
For example, let’s create a folder with the name “folder_name”. You can use any name. Type the following command and enter

mkdir folder_name

mkdir command

Here the mkdir is the command or the action you are taking and the folder_name is the argument. Now let’s see the directory using the ls command. Type the ls command and enter

ls

You will see the only directory with the name folder_name
Now if I want to know details about the folder_name then I will tell the ls command how to operate using the -l option. Type the command and check it

ls -l

ls -l command

You are seeing the permissions granted, created by, date of the director folder_name. These details will not appear if you simply use the ls command. The options after the command used to manipulate the command.

Important Keyboard Shortcuts

There are keyboard shortcuts also you should remember that will definitely save your time. The following shortcuts you should remember.

Tab Completion

Suppose you have folders, directory or filename. Rather than typing the full name of the folder or file just use the tab keyboard. Write the initial one or more alphabets of folder or file name and press the tab for auto-completion. Thus it saves time for you.

Text Navigation

When you write something on the command and want to correct some word or character then it becomes very tedious task. Therefore you should remember the following shortcuts.

Ctrl+A

It is for moving the cursor to the beginning line.
Ctrl +E

Use it for moving the cursor to the end of the line.
Ctrl + Left(ArrowKey)

Move cursor backward one word to the left at a time.
Ctrl + Right(ArrowKey)

Move cursor Forward one word to the right at a time.
Ctrl +U

For deleting or cropping the entire line or command if the cursor is at the end of the line.
Ctrl + K

It is used to delete or crop the entire line or command if the cursor is at the beginning of the line.
Ctrl + Y

Pasting cropped text.
Ctrl + Shift + C

Use to copy something in the clipboard
Ctrl + Shift + V

For pasting something from the clipboard

Bash Shortcuts

Up Arrow – It is used to recall the previous commands.
Down Arrow – You can use it for scrolling the previous commands.
Ctrl + R – For searching the history of all the commands used.
Ctrl + C – Cancel the command (Very Important).

Taking Help from the commands

The above commands are generally typed command that will save your time a lot if you have remembered. But you have to not remember everything as you can easily take the help for the commands or bash itself. Just like you refer books for gaining more knowledge about the topic in the same way you can type “man” before the command and it will list out all the commands related to that specific command. For example, I want to know some information about the ls command then I will type the following things

man ls

man ls command

You can see deep information about the ls command like what it does,  how to use this command in the synopsis. If you also know the command then use apropos followed by the “words”. For example, I want to know the zip command then type the following

apropos "zip"

It will show all the list of the commands related to zip like below.

apropos zip command

Conclusion

These are the Basics of Using the Linux Command Line. If you know the structure of the bash commands then you will easily remember most of the commands by practicing. But as I said, you don’t have to remember everything. Just take the help from terminal only.

Hope all of you have found this tutorial very interesting. If you have any query then please contact us or message to our Data Science Learner FB Page.

 

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Sukesh ( Chief Editor ), a passionate and skilled Python programmer with a deep fascination for data science, NumPy, and Pandas. His journey in the world of coding began as a curious explorer and has evolved into a seasoned data enthusiast.
 
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner