Linux Tutorial For Beginners- Part I

Why should you learn Linux?

Linux is an awesome OS to work with. It is very malleable and it is really really fun to work with linux OS. Am not going to elaborate on this. Just read the article published by redhat and You will understand why you should learn Linux.

Read: why should you learn linux

Choosing a distro:

When you start learning about linux , Redhat, Ubuntu, centos , Fedora, suse and mint are names that would be going through your brain. But believe me, there are nearly six hundred different distros of linux. I suggest you to start with Centos ( a derivative of Redhat enterprise linux) and Ubuntu ( a debian based distro). Choosing a distro is of your choice. For more  info on choosing a distro , read this

In this tutorial I will be explaining the important things to do when you start learning the Linux command line. I started learning linu from udemy course. If you are new to linux and you want a good grip on linux, you can subscribe for the online course. It is a really good course for linux foundation.

Course link: Linux tutorials by linux academy

Getting started:

Shell: To run command in Linux we use a command line interpreter called shell. You can virtually do any Linux based operations using the shell.

You can open a shell terminal using the GUI options in your distro or you can user Ctrl + Alt + T shortcut keys to open the terminal.

Also read: Linux shell scripting beginner tutorial

Viewing OS information:

cat command is used to view the contents of a file. The information about the CPU and OS are present inside files under the /etc folder.

1. Command to view the cpu information

2. Commad to find the OS details

Adding users and Passwrods:

1. Open the terminal and issue the following command to execute commands as root.

2. To Create an user , lets say scriptuser , execute the following command in the terminal

the above command creates a user “scriptuser”, create the home directory for the user.
3. Add password for the user.

4. Only the root user will have all the privileges to execute and modify all the files in the server. Inorder for the user to have certain privileges to executes commands and install softwares, it should have some root privileges. To provide the user root privileges , you should add the user to ther sudoers list. Sudoers file will be present inside the /etc folder. location: /etc/sudoers. Use any one of the foloowing commands to open the sudoers file.

vi is the editor for linux. There are other ediotors like nano.
5. Add the following line to the sudoers file.

scriptuser is the username and ALL=(ALL:ALL) ALL will give the user  certain root privileges. After adding this line , press Esc key , w and q to save the edited file. Now you will be able to execute commands using root privileges by using sudo before the command.

Working with directories (folders)and files:

1. Create a directory using the following command

2. Remove a directory

3. You can browse through the directories using cd (current directory) command

4. You can find the current working directory using the following command.

Editor:

vi is the commonly used and a very powerful text editor.

1. Open a file

2. Save a file by pressing the following keys consequently.

3. Exit the file without saving

4. Search for a particular word in a file

5. Delete a particular line
<pre>use dd by placing the cursor in the line which you want to delete the file.</pre>
6. Undo the action by pressing u
7. Copy and paste and particular line

To create a file you can either use the editor or touch command.

1. If you create a file using touch command, the file size will be zero.

2. Creating a file using vi.

3. Deleting a file

4. Force deleting

5. To delete all the files in a folder , cd in to the directory and issue the following command.

r stands for recursive and f stands for force, * denotes all.
6. To delete a folder with files.

7. Create a hidden file by appending a . operator before the file name.

Listing Files and folders:

1. You can list all the files and folders using the ls command.

2. Use the following command to list all the hidden folders

3. List all the files with particular extension.

4. List all the files with their starting with a

5. List all the files starting with letter a to d from a particular folder

kindly share this article and leave a comment for queries.

Related

If you are running mission critical applications on servers, it is important to monitor and notify the administrators…

Read more

Before understanding what hardlinks and softlinks are, you must have an idea about innodes in Linux Innode is related…

Read more

When you do an ssh to a remote server, you might see a welcome message with the OS name, Team name or the Company name.…

Read more

Internet is huge! Help us find great content

Newsletter

Never miss a thing! Sign up for our newsletter to stay updated.

About

The Best Tutorials & Tips to Speedup Your DevOps Workflow.

Created by Bibin Wilson.

​98
%

Off

Udemy Black Friday Offer Courses For $9.99 For Limited Time