Tutorial Linux: Understanding Directories and Pathnames

0
1879

Tutorial Linux: Understanding Directories and Pathnames – Need a quick Tutorial Linux on how to list and make a Directory, change from one Directory to another, and understand Pathnames? You’ve come to the right place as here, we’re going to give you a solid basic knowledge on all of those things.

All you need to know about Directories on UNIX

On your first login, your home directory is the current working directory and typically can be observed from its name – which is the same name you use as your username, for example sia88. This is where all your subdirectories and personal files are saved.

  1. List (ls)

This ls command typically lists all contents you have in your current Directory. However, it’s worth noting that the ls command doesn’t necessarily list all files in said Directory as it’s only capable of listing files which doesn’t begin with a dot as it’s a symbol used for hidden files. Should you wish to list all files including the hidden ones, type in % ls -a

2. Make Directory

To make a subdirectory called unixsub in your current Directory, type in % mkdir unixsub. To see the newly created subdirectory, type % ls

3. Change Directory

To  switch from your current Directory to the new one, type in % cd unixsub

All you need to know about Pathnames

Pathnames (print working directory or pwd) make it possible for user to find where you are in the system, by entering % pwd you’ll be presented with a full pathname as follows: /home/its/ug1/sia88 in which sia88 is your home directory and ug1 is the group directory.

To understand Pathnames, enter cd to switch back to home directory and then type in % ls unixsub to list its contents. Next type in % ls backups if you end up with backups: No such file or directory it basically means backups isn’t in your current directory. To list, type in % ls unixsub/backup.

NO COMMENTS

LEAVE A REPLY

This site uses Akismet to reduce spam. Learn how your comment data is processed.