Linux (Unix) Commands – File system commands



Linux (Unix) Commands – File system commands

• ls – list directory contents

ls [OPTION]... [FILE]...

Option:

-l use a long listing format

-a all, do not hide entries starting with .

• mkdir – make directories

mkdir [OPTION] DIRECTORY...

• cd – change working directory

cd directory

Note: cd . Means cd to current working directory

cd .. Means cd to the parent (one up) of the current directory

cd ~ Means cd to home directory

• pwd - print name of current/working directory

• mv – move (rename) files

mv [OPTION]... SOURCE DEST

mv [OPTION]... SOURCE... DIRECTORY

• cp - copy files and directories

cp [OPTION]... SOURCE DEST

cp [OPTION]... SOURCE... DIRECTORY

• rm - remove fies

rm [OPTION]... FILE...

• rmdir – remove empty directories

rmdir [OPTION] ... Directory

• chmod - change file access permissions

chmod [OPTION]... OCTAL_MODE FILE...

drwxrwxrwx

d indicates a directory, - indicates a file

Remaining symbols indicate permission

Left group of 3 indicates file permissions of owner

Middle group of 3 indicates file permissions for those in file group

Right group of 3 indicates file permissions for all others

For files:

r (or -) gives read permission (or not)

w (or -) gives write permission (or not)

x (or -) gives execution permission (or not)

For directories:

r (or -) gives list files in directory permission (or not)

w (or -) permission to delete files from directory or move files to it

x (or -) permission to access files in the directory

OCTAL_MODE examplex

777: sets all 9 permission bits (i.e. -rwxrwxrwx)

644: sets 4 of the permission bits (i.e. -rw-r—r--)

755: sets 7 of the permission bits (i.e. Rwxr-xr-x)

• find - search for files in a directory hierarchy

find [path...] [expression]

Examples:

find . -name dsb

find . -name ‘*dsb*’

find /tmp -name dsb

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download