Basic Linux Commands
Basic Linux Commands
chmod
Commands
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.
Structure –
Command <Options> <Arguments>
File Management and
Viewing
ls cal
cd whoami
mkdir cp
mv rm –r
pwd chmod
rmdir more
who history
cat echo
Permissions
There are three types of file access
supported by UNIX/LINUX.
− r – read, view the contents of a file or
a directory
− w –write, edit file/directory contents
− x –execute, run executable file
Permissions(contd..)
An example,
when we type ls-l , the output is like :
read=4 write=2
execute=1
4 + 2 + 1 4 + 0 + 1 4 + 0 + 0
7 5
4
Permissions(cont..)
rwx r-x r-- is a symbolic way to specify
file/directory modes, while 754 is a numeric way
(remember 7=111,5=101, 4=100).
Way to represent this file mode symbolically
--x --x –wx
Way to represent this bit string numerically
1 1 3
Permissions(cont..)
chmod
Stands for change mode.
chmod lets you tell the system how much
(or little) access it should permit to a
file/directory.
Permissions(contd..)
chmod
Examples:
− chmod 751 my_file – the owner of
my_file has rwx(7) permission, the
group has r-x(5) permission, others
have –x(1) permission.
Getting Started…
Create a new directory dir1 by using
the following command,
− mkdir dir1
− Go to this directory
− cd dir1
Use Cat to create a new file named
file1.c
Getting Started