Answers for "linux navigate file system"

1

linux navigate file system

# View file lists
$ pwd
/home/username
$ ls
.
..
bin
Desktop
despacer.sh
documentation.zip
Documents
Music
people
Pictures
Public

$ ls --classify 
.
..
bin/
Desktop/
despacer.sh
documentation.zip*
Documents/
Music/
people/
Pictures/
Public/

# Open a folder
$ pwd
/home/username
$ cd bin
$ pwd
/home/username/bin
$ ls
crossfade.sh
fop
normy.sh

# Close a folder
# If you're in one location because you used the cd command, 
# you can "close" that location by going back to your home directory.
$ cd
$ pwd
/home/username

# Navigate directories
# Here are some example paths:
/home/username/bin
/home/username/despacer.sh
/home/username/documentation.zip*
/home/username/people
# Because you return home often, your home directory can be abbreviated 
# as ~. For instance:
~/bin
~/despacer.sh
~/documentation.zip*
~/people
# To navigate directly to the people folder:
$ cd ~/people
$ pwd
/home/username/people
# To change to the developers directory from your current location, 
# do the following:
$ cd ./developers
$ pwd
/home/username/people/developers
# To reach the to /home/seth/people/developers directory instantly 
# from anywhere, instantly:
$ cd ~/people/developers
$ pwd
/home/username/people/developers

# Tell cd to take you up one folder: (You can keep using this trick)
$ cd ..
$ pwd
/home/username/people

# You can also return home using this shortcut:
$ cd ~
$ pwd
/home/username
# Or like this:
$ cd
$ pwd
/home/username

# Absolute paths
# Use the absolute path to any location:
$ cd ~/people/developers
$ pwd
/home/username/people/developers

# To find where you want to go, use the ls command to "open" a 
# directory and look inside:
$ ls --classify ~/people/
developers/
marketing/
$ cd /home/username/people/developers
$ pwd
/home/username/people/developers
Posted by: Guest on August-11-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language