$ pwd
It stands for "Print Working Directory. It is used to print the current working directory.
pwd
$ ls
It shows the contents of a directory and it will list the contents of the current directory.
ls
$ uname
It is used to print system information such as the operating system name, version, and release number.
uname
When you entered this command it will display the kernel name
$ cd
It uses for changing the directory.
cd
$ clear
It is used for clearing the terminal or screen.
clear
$ whoami
shows the current login username.
whoami
$ history
It displays the previously used command.
history
$ date
This command prints the date.
date
Creating a File & Directory
Creating a single directory
mkdir /mbubur
Note *: if you are not logged in through the root user use sudo before the cmd.
sudo mkdir /mbubur
Creating Multiple Directory with a single cmd
mkdir dir1 dir2 dir3 dir4
For creating a Directory path ( Directory inside the Directory)
mkdir -p /dev/static/image
Creating several directories
mkdir /dir{1..10}
Creating a File
$ touch
the touch command is used for only creating the empty file.
The command for creating a single file
touch test.txt
For creating the multiple files
touch test1.txt test2.txt test3.txt
For creating several files
touch book{1..20}
Copy and Past cmd
$ cp
This cmd is used for copy & paste files or folder.
syntext : cp <options> <source> <destination>
Options :
-r : recursive
-v : verbose
-f : forcefully
Example :
Copy a file from root directory to home directory
cp -rvf /root/test1.txt/home
Copy all data which start from D alphabet from root directory to home directory
cp -rvf /root/D*/home
Remove File and directory
For deleting all files or directory from this directory
rm -rvf /mbubux/test
For deleting all file in a directory named /home/test1/*
rm /home/test1/*
For moving or renaming files & directory
$ mv [Option] [source] [ Destination]
Move dir1 to dir2 ( Rename dir1 to dir2)
mv dir1 dir2
Move Directory dir1 dir2 dir3 to directory dir4
mv dir1 dir2 dir3 dir4
Task (Day-2)
- Check your present working directory.
- List all the files or directories including hidden files.
Create a nested directory A/B/C/D/E
mkdir -p A/B/C/D/E
Task (Day-3)
To view what's written in a file.
To change the access permissions of files.
chmod 777 foldernam
To check which commands you have run till now.
history
- To remove a directory/ Folder.
#remove file name
rm filename
#remove folder
rm foldername
- To create a fruits.txt file and to view the content.
#create file fruits.txt
vim fruits.txt
# viwe the contents file
cat fruits.txt
- Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
vim devops.txt
Show only the top three fruits from the file.
To Show only the bottom three fruits from the file.
To create another file Colors.txt and to view the content.
vim Colors.txt
To find the difference between fruits.txt and Colors.txt file.