How to Operate Linux for Beginners

How to Operate Linux for Beginners

First of all, what is Linux?

So, Linux is an operating system which is free and open source. And now if you are confused about "but why Linux?"

Well, I know Windows OS is the most famous amongst all OS and has the 74% of the market share for desktop users however Linux is a step ahead in this race where 90% of super-computers out of 500 run on Linux.

Also, Linux has lots of variants such as Ubuntu which is the most famous of all, Linux Mint, Cent Os, Kali and many more. Isn't that amazing?

As per linuxandubuntu.com Google, Oracle IBM, Facebook, Dell, Samsung, Amazon even Microsoft also use Linux.

Now let's jump to the

Basic commands for Linux

Folders / Directory

mkdir command is used to create directories.

To make a directory or folder, type:

mkdir <folder name> //single folder
mkdir <folder name> <folder name> ... //multiple folders

create directories

Congratulations! ๐ŸŽ‰ you have created your first folder.

Create nested folders

mkdir -p <folder name>/<folder name>/<folder name>

Files

touch is used for creating the file(s).

How to create files in Linux:

touch <file name> //for single file
touch <file name 1> <file name 2> ... //for multiple files

creating the file(s)

creating the file(s)

Create multiple files with range

touch <file_name>{Starting Range..Ending Range}.<file extention>

nested files

List out the folders and files

ls command is used to list out files and directories.

ls //to list out folders and files
ls -a //to list out all the files and folders including hidden

ist out the folders and files

Files and folders starting with dot (.) are hidden files and folders.

Change the directory

cd command is used for changing the directory.

cd <folder name> //going in to the folder
cd .. //coming out of the folder

Change the directory

Clear the screen

clear

Clear the screen

Clear the screen

Copy and Paste

cp command is used for copying and pasting files or folders.

cp <option> <source location> <destination location>

options:

  • -r for recursive

  • -v verbose

  • -f for forcefully

How to copy file:

copy paste

How to copy all data starting with specific characters:

cp <option> <source location with astring> <destination location>

let's copy all the books files to the student1 file

copy all data starting with specific characters

Delete

rm command is used to remove the file and directory.

Remove files and folders/directory

rm <option> <source location> <destination location>

options:

  • -r for recursive

  • -v verbose

  • -f for forcefully

Let's remove the studen1 folder:

Delete

Move and Rename

mv command is used to move as well as rename the file or folder.

How to Move files or directories:

mv <source location> <destination location>

Let's move the book1.txt to the student2 folder

Move and Rename

Let's rename the student2 to student_2

output

Super User

sudo stands for "super user do".

When you want to perform any task which is not permissible to the user can use this command to perform the task.

Here I tried to add a user but I got a permission denied error.

output

The same I tried with sudo, the task was performed and did not get any error.

output

Be a Super User

sudo su command gives you the wings! your account will be switched with the root user and can do all the tasks with no permission denied error. You can also access everything on the system with root user ability.

output

User Management

Create a user account

useradd command is used to create a user account.

useradd <option> <username>

output

option:

  • -m to make a directory for the user

Set password to a user account

passwd command is used to create a password for the user. And then it will ask to enter a password.

sudo passwd <username>

output

Switch User Account

To switch user su, a user password is required.

su neel

output

Logout from a user account

exit command is used to exit / logout from a user account. You can also use CTRL + D.

exit

output

Delete user account

userdel command is used to delete the user account. It may ask for a current user account password.

sudo userdel <username>

output

Change user account name

usermod command is used for changing name of the account.

sudo usermod -l <new_name> <old_name>

output

output

Well, I think that is all for the basics. For the advanced command I will post another blog. This #Linux blog is a part of #90DaysOfDevOps challenge with #TrainWithShubham community.

ย