













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














A command is a program which interacts with the kernel to provide the environment and perform the functions called for by the user.
A command can be: a built-in shell command; an executable shell file, known as a shell script; or a source compiled, object code file.
The shell is a command line interpreter. The user interacts with the kernel through the shell. You can write ASCII (text) scripts to be acted upon by a shell.
The original shell was the Bourne shell, sh.
Every Unix platform will either have the Bourne shell,
or a Bourne compatible shell available.
The default prompt for the Bourne shell is $ (or #, for the root user).
Another popular shell is C Shell. The default prompt for the C shell is %.
Numerous other shells are available from the network. Almost all of them are based on either sh or csh with extensions to provide job control to sh, allow in-line editing of commands, page through previously executed commands, provide command name completion and custom prompt, etc.
Some of the more well known of these may be on your favorite Unix system: the Korn shell, ksh, by David Korn and the Bourne Again SHell, bash, from the Free Software Foundations GNU project, both based on sh, the T-C shell, tcsh, and the extended C shell, cshe, both based on csh.
The first line is followed by commands
Within the scripts # indicates a comment from that point until the end of the line, with #! being a special case if found as the first characters of the file.
#!/bin/bash cd /tmp mkdir t
You also need to specify that the script is executable by setting the proper bits on the file with chmod, e.g.:
$ chmod +x shell_script
File Management and Viewing
Filesystem Mangement
Help, Job and Process Management
Network Management
System Management
User Management
Printing and Programming
Document Preparation
Miscellaneous
To understand the working of the command and
possible options use (man command)
Using the GNU Info System (info, info command)
Listing a Description of a Program (whatis command)
Many tools have a long−style option, `−−help', that
outputs usage information about the tool, including
the options and arguments the tool takes. Ex:
whoami --help
An important early development in Unix was the
invention of "pipes," a way to pass the output of one
tool to the input of another.
eg. $ who | wc −l
By combining these two tools, giving the wc
command the output of who, you can build a new
command to list the number of users currently on the
system
There are three such special permissions within Linux. They are: setuid — used only for applications, this permission indicates that the application is to run as the owner of the file and not as the user executing the application. It is indicated by the character s in place of the x in the owner category. If the owner of the file does not have execute permissions, the S is capitalized to reflect this fact. setgid — used primarily for applications, this permission indicates that the application is to run as the group owning the file and not as the group of the user executing the application. The setgid permission is indicated by the character s in place of the x in the group category. If the group owner of the file or directory does not have execute permissions, the S is capitalized to reflect this fact. sticky bit — used primarily on directories, this bit dictates that a file created in the directory can be removed only by the user that created the file. It is indicated by the character t in place of the x in the everyone category. If the everyone category does not have execute permissions, the T is capitalized to reflect this fact. Docsity.com
chown Change owner. Ex: chown
find Find files (find
Ex: find /home –name readme -print (Search for readme starting at home and output full path.)
“/home" = Search starting at the home directory and proceed through all its subdirectories "-name readme" = Search for a file named readme "-print" = Output the full path to that file
locate File locating program that uses the slocate database. Ex: locate –u to create the database,
pwd Print or list the present working directory with full path. rm Delete files (Remove files). (rm –rf <directory/file>) rmdir Remove a directory. The directory must be empty. (rmdir
File compression, backing up and restoring compress Compress data.
uncompress Expand data. cpio Can store files on tapes. to/from archives.
gzip - zip a file to a gz file. gunzip - unzip a gz file.
tar Archives files and directories. Can store files and directories on tapes.
Ex: tar -zcvf
unzip – Uncompresses a file with .zip extension. Docsity.com
cat View a file
Ex: cat filename
cmp Compare two files.
cut Remove sections from each line of files.
diff Show the differences between files.
Ex: diff file1 file2 : Find differences between file1 & file2.
echo Display a line of text.