You are on page 1of 13

Introduction to Linux commands

Linux commands

man -- displays manual pages. If you do not know about a command xx then type $man xx at the command prompt $. ls -- List the files and directories in the current directory. man ls -- show the manual pages about ls cat first.c -- displays contents of the file first.c

Linux commands

What does

$man man

do ?

Commands

Many commands take one or more arguments. $cc first.c -- here cc is the command first.c is the argument. Arguments gives the necessary data source or destination. $cp a.out first -- copies the file a.out into a file with name first

Commands

A command can be tailored by giving some options. $ls -l -l is the option, asking for long display of the file information. It displays along with files, the time of their creations, owner, permissions, etc. $rm temp.c removes the file temp.c

This is dangerous. $rm -i temp.c removes, but before doing this it asks you to confirm.

Commands

Manual pages gives you all information about options, arguments.

File system

The operating system supports a system called file system whose objectives are to create, maintain and delete the user/system information in the form of files. Files can be bundled in the form directories/folders. In Linux there is only one file system which maintains the files of all users.

File system
Root directory

etc bin

usr

usr1

usr2

File system

Every user will have a home directory. When the user logs into the system, he/she is placed at his/her home directory. Present working directory is the directory where you are working at present. $pwd -- displays the present working directory.

File system

Navigating the file system. $cd dir1 -- moves the present working directory to the directory dir1 (if at all dir1 is present in the pwd, otherwise it gives an error message) $cd .. -- moves to the parent directory (i.e., moves backwards) $mkdir dir1 -- creates a directory with name dir1 in the pwd. $rmdir dir1 -- removes an empty directory dir1.

File permissions

You cannot read many other files which are existing on the system. The files are protected against misuse. Every file has 3 category of users

User (that is you who created the file) Group (your group, this group is decided by the administator) Others (all others)

File permissions

For every category of users there are 3 possible actions with a file

Read (r) Write (w) (with this you can delete the file also !) Execute (x)

You can modify the file permissions by using a command chmod Read about this in the manual pages/other books.

This lecture gave you a tip of an iceberg. Read/explore to know more about your system !

You might also like