SlideShare a Scribd company logo
Simple commands in Linux:
1. Is – Displays information about files in the current directory.
Syntax of `ls` command in Linux
ls [option] [file/directory]
2. pwd – Displays the current working directory.
pwd [OPTIONS]
3. mkdir – Creates a directory.
Syntax:
mkdir [options...] [directories ...]
Options available in mkdir
1) –help:
It displays help-related information and exits.
Syntax:
mkdir --help
2) –version:
It displays the version number, some information regarding the license and exits.
Syntax:
mkdir –version
3)-p:
A flag which enables the command to create parent directories as necessary. If the
directories exist, no error is specified.
Syntax:
mkdir -p [directories]
4) -m:
This option is used to set the file modes, i.e. permissions, etc. for the created
directories. The syntax of the mode is the same as the chmod command.
Syntax:
mkdir -m a=rwx [directories]
4. cd – To navigate between different folders.
Syntax:
cd [directory_name]
Here, replace [directory_name] with the desired directory you want to move in.
For Example:
If we want to move to a subdirectory name “Documents”
cd Documents
5. rmdir – Removes empty directories from the directory lists.
Syntax- rmdir <directory>
6. cp – Moves files from one directory to another.
Syntax:
cp [OPTION] Source Destination
cp [OPTION] Source Directory
cp [OPTION] Source-1 Source-2 Source-3 Source-n Directory
Example:
$ ls
a.txt
$ cp a.txt b.txt
$ ls
a.txt b.txt
7. mv – Rename and Replace the files
Syntax:
mv [options(s)] [source_file_name(s)] [Destination_file_name]
8. rm – Delete files
Syntax:
rm [OPTION]... FILE...
Ex:
Removing one file at a time
$ rm a.txt
$ ls
b.txt c.txt d.txt e.txt
Removing more than one file at a time
$ rm b.txt c.txt
$ ls
d.txt e.txt
9. touch – Create empty files
Syntax:
touch file_name
10. cat – Display file contents on terminal
Syntax:
cat file_name
11. echo- Echo is a command used for displaying lines of text or string which are
passed as arguments on the command line
Syntax:
echo [string]
Example:
echo "MCA Class 1st"
12. clear – Clear terminal
Syntax:
reset
Practicals
1.ls Command with different argument
ls is a Linux shell command that lists directory contents of files and directories.
It provides valuable information about files, directories, and their attributes.
Syntax of `ls` command in Linux
ls [option] [file/directory]
Commonly Used Options in `ls` command in Linux
Options Description
-l
known as a long format that displays detailed information about files and
directories.
-a Represent all files Include hidden files and directories in the listing.
-t
Sort files and directories by their last modification time, displaying the
most recently modified ones first.
-r
known as reverse order which is used to reverse the default order of
listing.
-S Sort files and directories by their sizes, listing the largest ones first.
-R List files and directories recursively, including subdirectories.
-i
known as inode which displays the index number (inode) of each file and
directory.
Options Description
-g
known as group which displays the group ownership of files and
directories instead of the owner.
-h Print file sizes in human-readable format (e.g., 1K, 234M, 2G).
-d List directories themselves, rather than their contents.
2. File contained in home directory
There are multiple ways to access and return to the home directory. Some commands are very
helpful for the directories such as cd, pwd, mkdir, pwd, ls, and rmdir.
Here, we can explore our home directory.
Generally, our terminal opens with the user's particular directory. To change directory to
home directory, execute the cd command as follows:
1.cd /home
The above command will change the directory to home. To list the home directory,
execute the ls command as follows:
ls
We can get back to our home directory by executing the cd command without any
argument. It will back to our home directory from any directory we are working on.
Execute it as follows:
cd
2. pwd
To display the current working directory, execute the pwd command as follows:
pwd
3. mkdir
To create a directory under a directory, execute the mkdir command as follows:
mkdir <directory name>
3. Move the file from one directory to another
The mv command moves files and directories from one directory to another, or renames
a file or directory. If you move a file or directory to a new directory, it retains the base file
name. When you move a file .
Syntax:
mv [options(s)] [source_file_name(s)] [Destination_file_name]
4. The command to sort the directory to listing by the size
To sort files by size, use the option -S with the ls command. Mind it, it's capital S for
sorting. That's good but you can make it better by adding the -h option. This option
makes the output of the ls command displays the file size in human readable formats.
The -S option of the ls command sorts the files by size.
5. To print the current working directory
Print Current DirectoryTo know your current directory, you can use
the pwd command which stands for Print Working Directory.
Syntax of `pwd` command in Linux
pwd [OPTIONS]
This command doesn’t have any arguments or options, but it can accept flags for
specific behavior.
Flags For Specific behavior in `pwd` command in Linux.
 The “-L” flag resolves symbolic links and prints the path of the target directory.
 The default behavior of the shell built-in “pwd” is equivalent to using “pwd -L”.
 Mention the “-P” flag, which displays the actual path without resolving symbolic
links.
 The default behavior of the binary “/bin/pwd” is the same as using “pwd -P”

More Related Content

Similar to linux commands.pdf

8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
CharuJain396881
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
Tushar B Kute
 
Chapter 4 Linux Basic Commands
Chapter 4 Linux Basic CommandsChapter 4 Linux Basic Commands
Chapter 4 Linux Basic Commands
Shankar Mahure
 
Directories description
Directories descriptionDirectories description
Directories description
Dr.M.Karthika parthasarathy
 
Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX Commands
Subra Das
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Ciceer Ghimirey
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Ciceer Ghimirey
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to LinuxDimas Prasetyo
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
vamsikrishna204239
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
vamsikrishna204239
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
BITS
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
David Harris
 
Linux - Directory commands
Linux - Directory commandsLinux - Directory commands
Linux - Directory commands
joesofi
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
thakor bharati
 

Similar to linux commands.pdf (20)

8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Chapter 4 Linux Basic Commands
Chapter 4 Linux Basic CommandsChapter 4 Linux Basic Commands
Chapter 4 Linux Basic Commands
 
Directories description
Directories descriptionDirectories description
Directories description
 
Basics of UNIX Commands
Basics of UNIX CommandsBasics of UNIX Commands
Basics of UNIX Commands
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptx
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptxLab 3 -Linux Files, Directories and Basic Commands.pptx
Lab 3 -Linux Files, Directories and Basic Commands.pptx
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 
Linux
LinuxLinux
Linux
 
Linux - Directory commands
Linux - Directory commandsLinux - Directory commands
Linux - Directory commands
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
 

Recently uploaded

太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
foismail170
 
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaInteractive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
23211a7274
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
larisashrestha558
 
132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences
Manu Mitra
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
IrlanMalik
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
Dr. Mary Askew
 
How Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
How Mentoring Elevates Your PM Career | PMI Silver Spring ChapterHow Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
How Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
Hector Del Castillo, CPM, CPMM
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
ragingokie
 
Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.
alexthomas971
 
Full Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptxFull Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptx
mmorales2173
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
foismail170
 
Operating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdfOperating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdf
harikrishnahari6276
 
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Dirk Spencer Corporate Recruiter LION
 
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
foismail170
 
Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!
LukeRoyak
 
How to create an effective K-POC tutorial
How to create an effective K-POC tutorialHow to create an effective K-POC tutorial
How to create an effective K-POC tutorial
vencislavkaaa
 
Brand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio IBrand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio I
thomasaolson2000
 
How to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and BusinessHow to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and Business
ideatoipo
 
My Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya WestrinMy Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya Westrin
AlinaseFaith
 
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
gobogo3542
 

Recently uploaded (20)

太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
 
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaInteractive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
 
132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
 
How Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
How Mentoring Elevates Your PM Career | PMI Silver Spring ChapterHow Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
How Mentoring Elevates Your PM Career | PMI Silver Spring Chapter
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
 
Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.
 
Full Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptxFull Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptx
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
 
Operating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdfOperating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdf
 
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
 
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
 
Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!
 
How to create an effective K-POC tutorial
How to create an effective K-POC tutorialHow to create an effective K-POC tutorial
How to create an effective K-POC tutorial
 
Brand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio IBrand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio I
 
How to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and BusinessHow to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and Business
 
My Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya WestrinMy Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya Westrin
 
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
 

linux commands.pdf

  • 1. Simple commands in Linux: 1. Is – Displays information about files in the current directory. Syntax of `ls` command in Linux ls [option] [file/directory] 2. pwd – Displays the current working directory. pwd [OPTIONS] 3. mkdir – Creates a directory. Syntax: mkdir [options...] [directories ...] Options available in mkdir 1) –help: It displays help-related information and exits. Syntax: mkdir --help 2) –version: It displays the version number, some information regarding the license and exits. Syntax: mkdir –version 3)-p: A flag which enables the command to create parent directories as necessary. If the directories exist, no error is specified. Syntax: mkdir -p [directories]
  • 2. 4) -m: This option is used to set the file modes, i.e. permissions, etc. for the created directories. The syntax of the mode is the same as the chmod command. Syntax: mkdir -m a=rwx [directories] 4. cd – To navigate between different folders. Syntax: cd [directory_name] Here, replace [directory_name] with the desired directory you want to move in. For Example: If we want to move to a subdirectory name “Documents” cd Documents 5. rmdir – Removes empty directories from the directory lists. Syntax- rmdir <directory> 6. cp – Moves files from one directory to another. Syntax: cp [OPTION] Source Destination cp [OPTION] Source Directory cp [OPTION] Source-1 Source-2 Source-3 Source-n Directory Example: $ ls a.txt $ cp a.txt b.txt $ ls a.txt b.txt
  • 3. 7. mv – Rename and Replace the files Syntax: mv [options(s)] [source_file_name(s)] [Destination_file_name] 8. rm – Delete files Syntax: rm [OPTION]... FILE... Ex: Removing one file at a time $ rm a.txt $ ls b.txt c.txt d.txt e.txt Removing more than one file at a time $ rm b.txt c.txt $ ls d.txt e.txt 9. touch – Create empty files Syntax: touch file_name 10. cat – Display file contents on terminal Syntax: cat file_name 11. echo- Echo is a command used for displaying lines of text or string which are passed as arguments on the command line Syntax: echo [string] Example: echo "MCA Class 1st"
  • 4. 12. clear – Clear terminal Syntax: reset Practicals 1.ls Command with different argument ls is a Linux shell command that lists directory contents of files and directories. It provides valuable information about files, directories, and their attributes. Syntax of `ls` command in Linux ls [option] [file/directory] Commonly Used Options in `ls` command in Linux Options Description -l known as a long format that displays detailed information about files and directories. -a Represent all files Include hidden files and directories in the listing. -t Sort files and directories by their last modification time, displaying the most recently modified ones first. -r known as reverse order which is used to reverse the default order of listing. -S Sort files and directories by their sizes, listing the largest ones first. -R List files and directories recursively, including subdirectories. -i known as inode which displays the index number (inode) of each file and directory.
  • 5. Options Description -g known as group which displays the group ownership of files and directories instead of the owner. -h Print file sizes in human-readable format (e.g., 1K, 234M, 2G). -d List directories themselves, rather than their contents. 2. File contained in home directory There are multiple ways to access and return to the home directory. Some commands are very helpful for the directories such as cd, pwd, mkdir, pwd, ls, and rmdir. Here, we can explore our home directory. Generally, our terminal opens with the user's particular directory. To change directory to home directory, execute the cd command as follows: 1.cd /home The above command will change the directory to home. To list the home directory, execute the ls command as follows: ls We can get back to our home directory by executing the cd command without any argument. It will back to our home directory from any directory we are working on. Execute it as follows: cd 2. pwd To display the current working directory, execute the pwd command as follows: pwd
  • 6. 3. mkdir To create a directory under a directory, execute the mkdir command as follows: mkdir <directory name> 3. Move the file from one directory to another The mv command moves files and directories from one directory to another, or renames a file or directory. If you move a file or directory to a new directory, it retains the base file name. When you move a file . Syntax: mv [options(s)] [source_file_name(s)] [Destination_file_name] 4. The command to sort the directory to listing by the size To sort files by size, use the option -S with the ls command. Mind it, it's capital S for sorting. That's good but you can make it better by adding the -h option. This option makes the output of the ls command displays the file size in human readable formats. The -S option of the ls command sorts the files by size. 5. To print the current working directory Print Current DirectoryTo know your current directory, you can use the pwd command which stands for Print Working Directory. Syntax of `pwd` command in Linux pwd [OPTIONS] This command doesn’t have any arguments or options, but it can accept flags for specific behavior.
  • 7. Flags For Specific behavior in `pwd` command in Linux.  The “-L” flag resolves symbolic links and prints the path of the target directory.  The default behavior of the shell built-in “pwd” is equivalent to using “pwd -L”.  Mention the “-P” flag, which displays the actual path without resolving symbolic links.  The default behavior of the binary “/bin/pwd” is the same as using “pwd -P”