Linux Basic Command for Beginner

Linux Basic Command for Beginner

#This is My First Blog #Linux Series1 #CheatSheet

Β·

5 min read

Hello Fellow Reader,

Few months back I installed Ubuntu (Linux Distro) in my personal computer along with windows10 just for fun, but I ended up liking the Linux then windows10 I know Linux as a lot of flaws and driver issue at last I resolved all and got entire Linux in my hand.

So, I started using Linux initially it was hell for me to understand the architecture of Linux and especially commands then I sat everyday night to get in a touch with Linux command

Here, I'm sharing some useful 10[1-10] basic commands of Linux for beginner (those who starting their baby step in Linux world) I learned till now for the noobs like me

image.png

Top 10 Beginner Linux Command we have to Master:

1. man

This is very important command new user should know, man is nothing but manual. Every time If you don't know how to use a particular command then try this out!

man <command>

example:

man ls

image.png

From the above screenshot you can understand What are all stuffs we can do with command called ls

2. cd

In order to move to some directory or particular directory, we can use cd command for that and here we have to specify the path of the directory it's like switching between directory we have in our computer

cd downloads

image.png The below command will help us to switch back to one directory now I'm in this path ~/downloads/test/sample I have to switch back to test folder & so on, then by using below command we can achieve that

cd ..

image.png

Note: Here ~ sign is nothing but Home Directory

3. ls

This ls command is used to list the file we have in directory let me show some examples below for your understanding

ls

image.png

In Above example I'm in downloads folder there I'm running this command to get the list of files resides in that particular folder

ls accepts a lot of options. One of my favorite options combinations is - al . Try it: This will print hidden files also

ls -al

This will print all files except hidden one’s

ls -l

image.png

Compared to the plain ls, this returns much more information.

You have, from left to right:

  • the number of links to that file
  • the owner of the file
  • the group of the file
  • the file size in bytes
  • the file modified datetime
  • the file name

This set of data is generated by the-l option. The -al option instead also shows the hidden files.

Hidden files are files that start with a dot ( . ).

4.pwd

Whenever you feel lost in file system, just try this command to know where you are currently in.

pwd

image.png

5.mkdir

This command will help us to create folder/directory in file system

You create folders using the mkdir command:

mkdir fruits

You can create multiple folders with one command:

mkdir dogs cars

You can also create multiple nested folders by adding the -p option:

mkdir -p fruits/apples

image.png

6.rmdir

Just like creating a folder using mkdir , you can delete a folder using rmdir :

mkdir fruits
rmdir fruits

The folder you delete must be empty

To delete folders with files in them, we'll use the more generic rm command which deletes files and folders, using the -rf options:

rm -rf fruits apples

image.png You can also delete multiple folders at once:

rmdir dog cat

image.png

7.mv

This command is used to move file from one locality to other

mv <source> <destination>

touch pear
touch apple
mkdir fruits
mv pear apple fruits   #pear and apple moved to the fruits folder

image.png

8.touch

touch command is used to create an empty file in the file system

touch sample

image.png

9.cp

cp command is used to copy the file from one location to other

cp <source> <destination>

image.png

For copying entire directory to directory we have to use -r

cp -r <sourcefolder> <destinationfolder>

image.png

10.sudo

This is one of the finest and very important command for all Linux users here Basically sudo is used to run commands as root user

You must be enabled to use sudo, and once you do, you can run commands as root by entering your user's password (not the root user password).

The permissions are highly configurable, which is great especially in a multiuser server environment, and some users can be granted access to running specific commands through sudo.

You can run

sudo -i

to start a shell as root:

image.png Now I'm in root user, please note: avoid using root account while working on Linux because in root we have all configuration files if anything goes wrong entire Linux will crash

Good Practice will be using Normal user account only

some commands require root permission, at the time we can invoke root user power as superuser with the help of sudo command

for example

image.png

In order to become as a superuser for one command use sudo apt-get update

image.png

End Note: Linux is Super powerful 😎

Β