Unix Shell Commands
Unix Shell Commands
Index
Sno Command Page
1 mkdir
2 rmdir
3 cat
4 cd
5 cp
6 mv
7 rm
8 ls
9 lsattr
10 lsof
11 chmod
12 chown
13 chgrp
14 cksum
15 cmp
16 dd
17 du
18 df
19 fsck
20 fuser
21 ln
22 mount
23 pwd
24 split
25 touch
26 umask
To view help for any command, we have three approaches.
1. <command> --help
2. Man <command>
3. Info <command>
Eg:
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
directory to CTX
NAME
SYNOPSIS
DESCRIPTION
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE
-p, --parents
-v, --verbose
-Z, --context=CTX
--version
NAME
SYNOPSIS
DESCRIPTION
too.
-m, --mode=MODE
-p, --parents
-v, --verbose
-Z, --context=CTX
CTX
--version
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
1.mkdir:
NAME
SYNOPSIS
DESCRIPTION
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE
-p, --parents
-v, --verbose
-Z, --context=CTX
CTX
2. rmdir:
NAME
SYNOPSIS
DESCRIPTION
--ignore-fail-on-non-empty
-p, --parents
Remove DIRECTORY and its ancestors. E.g., rmdir -p a/b/c is similar to rmdir a/b/c a/b a.
-v, --verbose
--version
3.cat
NAME
SYNOPSIS
-A, --show-all
equivalent to -vET
-b, --number-nonblank
-e equivalent to -vE
-E, --show-ends
-n, --number
-s, --squeeze-blank
-t equivalent to -vT
-T, --show-tabs
-u (ignored)
-v, --show-nonprinting
--version
EXAMPLES
cat f - g
4.cd
"cd" stands for change directory. It is the primary command for moving around the file system.
cd /usr
This command moves you to the "/usr" directory. "/usr" becomes your current working directory.
cd /usr/fred
Moves you to the "/usr/fred" directory.
cd /u*/f*
Moves you to the "/usr/fred" directory - if this is the only directory matching this wildcard pattern.
cd
Issuing the "cd" command without any arguments moves you to your home directory.
cd -
Using the Korn shell, this command moves you back to your previous working directory. This is very
useful when you're in the middle of a project, and keep moving back-and-forth between two directories.
5.cp
NAME
SYNOPSIS
DESCRIPTION
-a, --archive
same as -dpR
--backup[=CONTROL]
--copy-contents
-f, --force
-i, --interactive
-l, --link
-L, --dereference
-P, --no-dereference
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
--no-preserve=ATTR_LIST
dont preserve the specified attributes
--parents
--remove-destination
remove each existing destination file before attempting to open it (contrast with --force)
--sparse=WHEN
--strip-trailing-slashes
-s, --symbolic-link
-S, --suffix=SUFFIX
-t, --target-directory=DIRECTORY
-T, --no-target-directory
-u, --update
copy only when the SOURCE file is newer than the destination file or when the destination file is
missing
-v, --verbose
-x, --one-file-system
stay on this file system
--version
By default, sparse SOURCE files are detected by a crude heuristic and the corresponding DEST file
is made sparse as well. That is the behavior
selected by --sparse=auto. Specify --sparse=always to create a sparse DEST file whenever the
SOURCE file contains a long enough sequence of zero
The backup suffix is ~, unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control
method may be selected via the --backup option or
none, off
numbered, t
existing, nil
simple, never
As a special case, cp makes a backup of SOURCE when the force and backup options are given and
SOURCE and DEST are the same name for an existing,
regular file.
6. mv
NAME
mv - move (rename) files
SYNOPSIS
DESCRIPTION
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL]
-f, --force
-i, --interactive
--strip-trailing-slashes
-t, --target-directory=DIRECTORY
-T, --no-target-directory
-u, --update
move only when the SOURCE file is newer than the destination file or when the destination file is
missing
-v, --verbose
--version
The backup suffix is ~, unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control
method may be selected via the --backup option or
none, off
never make backups (even if --backup is given)
numbered, t
existing, nil
simple, never
7. rm
NAME
SYNOPSIS
rm [OPTION]... FILE...
DESCRIPTION
This manual page documents the GNU version of rm. rm removes each specified file. By default, it
does not remove directories.
If the -I or --interactive=once option is given, and there are more than three files or the -r, -R, or --
recursive are given, then rm prompts the
user for whether to proceed with the entire operation. If the response is not affirmative, the entire
command is aborted.
Otherwise, if a file is unwritable, standard input is a terminal, and the -f or --force option is not
given, or the -i or --interactive=always
option is given, rm prompts the user for whether to remove the file. If the response is not
affirmative, the file is skipped.
OPTIONS
-f, --force
-I prompt once before removing more than three files, or when removing recursively. Less
intrusive than -i, while still giving protection
--interactive[=WHEN]
prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompt always
--one-file-system
when removing a hierarchy recursively, skip any directory that is on a file system different from
that of the corresponding command line
argument
--no-preserve-root
do not treat / specially
--preserve-root
-v, --verbose
--version
By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each
listed directory, too, along with all of its
contents.
To remove a file whose name starts with a -, for example -foo, use one of these commands:
rm -- -foo
rm ./-foo
Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If
you want more assurance that the con
8. ls