Day 3-Basic Linux Commands

Day 3-Basic Linux Commands

Day 3 Task: Basic Linux Commands

To get the manual of that command

man <commandname>

To list

ls

To get more info about the contents inside the file.

ls -al

To show hidden files

ls -a 

To create a directory/folder

mkdir <new dir name>

To remove the empty dir/folder

rmdir  <dir name>

To remove the dir with files in them

rm -rf  <dirname>

To move the files/Rename the files

mv <sourcefile>  <destinationfile>

To go down two directories

cd ../..

To search for a specific file name or extension | 

ls -la *<filename>

To go to home dir

cd ~

To view what's written in a file.

cat <filename>

To change the access permissions of files.

chmod <permissions> <filename> 

To check which commands you have run till now.

history 

To get a history of only the last 5 commands

history 5

To create a fruits.txt file and to view the content.

touch fruits.txt and then cat fruits.txt

To add content in devops.txt (One in each line)

vi devops.txt

Show only the top three fruits from the file.

head -n 3 fruits.txt

Show only the bottom three fruits from the file.

tail -n 3 fruits.txt

To create another file Colors.txt and to view the content.

touch colors.txt and then cat colors.txt

To Add content in Colors.txt (One in each line)

vi colors.txt

To find the difference between fruits.txt and Colors.txt files.

diff fruits.txt colors.txt

To count the word

wc <filename>

To search for anything in the big folder/file

grep <filename>

These are only basic commands. Apart from these, there are a lot more. Also, most of the commands accept a lot of options. ex: ls, ls -a, ls -l, ls -ldr, ll etc.. so you can use them accordingly as per your requirement.

#90daysofdevops

Will write the next chapter soon. till then,

Happy learning :)