Babies Guide to working with directories Linux/Solaris

Here a a basic list of commands to help newbies to work with directories on Linux / Unix

1) How to create a folder

mkdir - this command will make/create a directory


e.g. bash# mkdir folder1


(this command will create a folder 

2) Removing a folder

rmdir - Remove/deletes a folder

e.g. bash# rmdir folder1

flags :
-r  Recursive (very dangerous if you don't know what your doing, i say it cuz of personal experience)
-f  Force (removes files that will not be able to be removed with the normal rmdir command)

these flags are to be used in between the after the rmdir e.g. bash# rmdir -r folder1 



3) Navigating between folders using cd

cd - command is used to change berween directories


e.g. bash# cd /local

This command will change your current directory as /local and you will be able to view files in that directory


4) list the files in the current directory 

e.g. bash# ls -l

(this command will display list of all files within the directory with all its permissions)


flags :

-a  displays all files (including hidden files/folders)

-l   lists all permissions like read, write and execute permissions for (user, group, others)
-h  human readable form (converts file size in human readable form while listing the files)


5) chmod - Change mode is a command to change the permissions of files/directories


4- read
2- write
1- Execute


Combination of this can be used as 777, 755, etc.

e.g. bash# chmod 755 filename.

No comments:

Post a Comment