Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Working with directories

Working with directories

 pwd
 cd
 absolute and relative paths
 path completion
 ls
 mkdir
 rmdir
pwd

 man pwd
 The pwd command (Print Working Directory).
 The command or tool displays your current directory.
cd

 man cd
 This takes us to the BASH_BUILTINS
 The cd command is just one of the commands on the list of bash builtins
cd

 The cd command lets you change your current directory.


 It represents your legs and how you walk or move around in the Linux file system.
 You move from one location(folder or directory) to another location(folder or directory).
cd
Home Directory

 Your home directory or home folder is a folder/directory created when your user account
is created on the system.
 The Linux administrative user root has its home as /root
 All other system users have a home in /home
 The user’s home is always a folder or directory with the user account name
 root home directory: /root
 sefange home directory: /home/sefange
cd ~

 The cd is also a shortcut to get back into your home directory.


 If you type cd without a target directory, you end up in your home directory.
 Typing cd ~ also puts you in your home directory.
cd ..

 Use cd .. To go to the parent directory (the directory above your current directory in
the directory tree)
cd .

 Use cd . To stay in the current directory.


cd -

 You can also use cd - to go to the previous directory


Absolute and relative paths

 Absolute path: When you type a path starting with a slash (/)
 The root of the file tree is assumed.
 In this case the full address starts with / and ends in your desired destination
folder/directory.
Absolute and relative paths

 Relative paths:
 If you don't start your path with a slash: The current directory is the assumed starting
point.
 When you login to Linux you are placed in your home directory. Your current directory
changes as you start to navigate around. So always check your current directory with pwd
and issue ls to list the contents.
Path completion

You might also like