SlideShare a Scribd company logo
Linux Basic Commands
Complete Common File System Tasks
 Navigating the file system
 Managing files and directories
• Navigating the File System
 pwd (Present Working Directory)
 cd
 ls
Using the pwd Command
pwd stands for Print Working Directory or Present
Working Directory
It prints the path of the working directory, starting
from the root.
This is necessary as it let you know where your files
are saved.
Syntax: $ pwd
Using the cd Command
cd command in Linux known as change directory
command. It is used to change current working directory.
Syntax:
$ cd [directory]
Example: $ cd dir1
To move back to parent directory:
$cd ..
Using the ls Command
ls is a Linux shell command that lists directory contents
of files and directories.
Syntax: ls [options]
ls
 –a Displays all files, including hidden files.
 –l Displays a long listing of the directory
contents. This is a very useful option. You can
use it to see the file names, ownership,
permissions, modification date, and size.
 –R Displays directory contents recursively;
that is, it displays the contents of the current
directory as well as the contents of all
subdirectories.
• Managing files and directories
 Creating files and directories
 Viewing file contents
 Deleting files and directories
 Copying and moving files and directories
Creating Directories
 mkdir command in Linux allows the user to create
directories (also referred to as folders in some
operating systems ). This command can create
multiple directories at once
 Syntax: $ mkdir new_directory
Viewing Text File Contents
cat
 It reads data from the file and gives their
content as output. It helps us to create, view,
concatenate files.
 The cat filename command will display the
specified text file on screen.
 Syntax: $ cat filename
Deleting Files and Directories
 rmdir
 rm
rmdir
 This utility can be used to delete an existing
directory. To use it, simply enter
 rmdir directory_name
 For example, rmdir MyFiles.
 Be aware, however, that rmdir requires that
the directory be empty before it will delete it.
rm
 The rm utility is a more powerful deletion utility
that can be used to delete either a file or a
populated directory.
 To delete a file, simply enter rm filename.
 To delete a directory, enter
rm –r directory_name.
rm
 Be careful with rm! By default, it won’t prompt
you to confirm a deletion operation. It assumes
that you really meant to delete the file or
directory.
 If you want rm to prompt you before deleting a
file or directory, include the –i option.
Copying and Moving Files and
Directories
 cp
 mv
cp
 This utility is used to copy files or entire
directory structures from one location in the file
system to another.
 For example, to copy a file named
/tmp/schedule.txt to your home directory, you
could enter
cp /tmp/schedule.txt ~.
mv
 The mv command is used much like cp.
However, it will copy the specified file to the
new location in the file system and then delete
the original.
 For example, to move a file named mylog.txt
from /tmp to /var/log, you would enter
 mv /tmp/mylog.txt /var/log
mv
 The mv command is also used to rename
files. Simply enter mv followed by the file to be
renamed and then the new file name.
 For example, to rename schedule.txt to
schedule.old, you would enter
mv schedule.txt schedule.old.

More Related Content

Similar to LinuxLabBasics.ppt (20)

DOC
Unix Basics For Testers
nitin lakhanpal
 
PDF
Linux cheat sheet
Dimitris Kyrgiafinis
 
PDF
Basics of UNIX Commands
Subra Das
 
PPT
Linux basic commands
MohanKumar Palanichamy
 
PPT
Linux ppt
Sanmuga Nathan
 
PPTX
Linux commands
penetration Tester
 
PDF
Command Line Tools
David Harris
 
PDF
Linux_Commands.pdf
MarsMox
 
PPT
Linux commands
U.P Police
 
PDF
Basic linux commands
Shakeel Shafiq
 
PDF
Basic shell programs assignment 1_solution_manual
Kuntal Bhowmick
 
PPTX
Directory Commands - R.D.Sivakumar
Sivakumar R D .
 
PPTX
Linux System commands Essentialsand Basics.pptx
mba1130feb2024
 
PPTX
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
DOCX
Directories description
Dr.M.Karthika parthasarathy
 
DOCX
Internal commands of dos
Nargiskhan786
 
PPT
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
PDF
Course 102: Lecture 3: Basic Concepts And Commands
Ahmed El-Arabawy
 
DOCX
Chapter 4 Linux Basic Commands
Shankar Mahure
 
PPT
linux-lecture4.ppt
LuigysToro
 
Unix Basics For Testers
nitin lakhanpal
 
Linux cheat sheet
Dimitris Kyrgiafinis
 
Basics of UNIX Commands
Subra Das
 
Linux basic commands
MohanKumar Palanichamy
 
Linux ppt
Sanmuga Nathan
 
Linux commands
penetration Tester
 
Command Line Tools
David Harris
 
Linux_Commands.pdf
MarsMox
 
Linux commands
U.P Police
 
Basic linux commands
Shakeel Shafiq
 
Basic shell programs assignment 1_solution_manual
Kuntal Bhowmick
 
Directory Commands - R.D.Sivakumar
Sivakumar R D .
 
Linux System commands Essentialsand Basics.pptx
mba1130feb2024
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
Directories description
Dr.M.Karthika parthasarathy
 
Internal commands of dos
Nargiskhan786
 
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
Course 102: Lecture 3: Basic Concepts And Commands
Ahmed El-Arabawy
 
Chapter 4 Linux Basic Commands
Shankar Mahure
 
linux-lecture4.ppt
LuigysToro
 

Recently uploaded (20)

PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Evaluation and thermal analysis of shell and tube heat exchanger as per requi...
shahveer210504
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Day2 B2 Best.pptx
helenjenefa1
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
GitOps_Without_K8s_Training simple one without k8s
DanialHabibi2
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Design Thinking basics for Engineers.pdf
CMR University
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Ad

LinuxLabBasics.ppt

  • 2. Complete Common File System Tasks  Navigating the file system  Managing files and directories
  • 3. • Navigating the File System  pwd (Present Working Directory)  cd  ls
  • 4. Using the pwd Command pwd stands for Print Working Directory or Present Working Directory It prints the path of the working directory, starting from the root. This is necessary as it let you know where your files are saved. Syntax: $ pwd
  • 5. Using the cd Command cd command in Linux known as change directory command. It is used to change current working directory. Syntax: $ cd [directory] Example: $ cd dir1 To move back to parent directory: $cd ..
  • 6. Using the ls Command ls is a Linux shell command that lists directory contents of files and directories. Syntax: ls [options]
  • 7. ls  –a Displays all files, including hidden files.  –l Displays a long listing of the directory contents. This is a very useful option. You can use it to see the file names, ownership, permissions, modification date, and size.  –R Displays directory contents recursively; that is, it displays the contents of the current directory as well as the contents of all subdirectories.
  • 8. • Managing files and directories  Creating files and directories  Viewing file contents  Deleting files and directories  Copying and moving files and directories
  • 9. Creating Directories  mkdir command in Linux allows the user to create directories (also referred to as folders in some operating systems ). This command can create multiple directories at once  Syntax: $ mkdir new_directory
  • 10. Viewing Text File Contents cat  It reads data from the file and gives their content as output. It helps us to create, view, concatenate files.  The cat filename command will display the specified text file on screen.  Syntax: $ cat filename
  • 11. Deleting Files and Directories  rmdir  rm
  • 12. rmdir  This utility can be used to delete an existing directory. To use it, simply enter  rmdir directory_name  For example, rmdir MyFiles.  Be aware, however, that rmdir requires that the directory be empty before it will delete it.
  • 13. rm  The rm utility is a more powerful deletion utility that can be used to delete either a file or a populated directory.  To delete a file, simply enter rm filename.  To delete a directory, enter rm –r directory_name.
  • 14. rm  Be careful with rm! By default, it won’t prompt you to confirm a deletion operation. It assumes that you really meant to delete the file or directory.  If you want rm to prompt you before deleting a file or directory, include the –i option.
  • 15. Copying and Moving Files and Directories  cp  mv
  • 16. cp  This utility is used to copy files or entire directory structures from one location in the file system to another.  For example, to copy a file named /tmp/schedule.txt to your home directory, you could enter cp /tmp/schedule.txt ~.
  • 17. mv  The mv command is used much like cp. However, it will copy the specified file to the new location in the file system and then delete the original.  For example, to move a file named mylog.txt from /tmp to /var/log, you would enter  mv /tmp/mylog.txt /var/log
  • 18. mv  The mv command is also used to rename files. Simply enter mv followed by the file to be renamed and then the new file name.  For example, to rename schedule.txt to schedule.old, you would enter mv schedule.txt schedule.old.