Sie sind auf Seite 1von 9

Experiment 6

Aim: Introduction to file system of linux and basic troubleshooting and maintenance in Linux
Problem statement: Basic commands used in file system, troubleshooting and
maintenance in linux environment.

Theory:
Basic of linux Operating system

1.1 OPERATING SYSTEM:

Definition: Operating System is a collection of programs that coordinates the operation of


computer hardware & software.

1.1.1 FUNCTIONS OF OPERATING SYSTEM:-

Process Management

Memory Management

Data Management

I/O Management

1.2LINUX ARCHITECTURE:
1.2.1 KERNEL:

A set of functions that make up the heart of an OS

It is used to provide an application interface between programs and physical devices.

Services provided by the kernel

Controls execution of processes.

Scheduling processes fairly for execution on the CPU.

Allocating memory for an executing process.

1.2.2 SHELL:

Shell is the interface between the user and the kernel

Services provided by the shell

It interprets all the commands to the kernel

The kernel after processing the commands gives back to the shell.

LINUX FILE SYSTEM HIERARCHY

This Directory is called as root Directory.

It is the top of the file system structure.

All other Directories are mounted under it.

/root :- :-This is the default home directory of administrator (i.e., root).

/home :- :- It contains all users home directories.

/boot :- This Directory contains the Kernel, the core of the operating system. This also contains
the files related to booting the system such as the boot loader and the initial ramdisk.

/sbin :-It contains administrative commands used by superuser.

/bin :-This Directory contains command used by the superuser and the normal users.

/usr :-It contains the programs and applications which are available for users (similar to

program files on windows)

/var :-It contains variable information , such as logs and print queues.
/dev :-This Directory contains devices nodes through which the operating system can access

hardware and software devices on the system.

/etc :-It contains all configuration files.

/proc :-This Directory is a mount point for virtual information about currently running system

processes. This Directory is empty until the proc file system is mounted.

/tmp :-This Directory contains temporary files used by the system

/opt :-It contains the third party applications . ex:- Corel Word Perfect Sun Star Office

/media -It contains default mount points of removable media such as cdrom,floppydisk, pendrive.

/lib :-It contains libraries need by no. of different applications as well as linux kernel.

Basic commands of file system

1) Print Working Directory :-root@localhost ~]# pwd

Shows list of files & directories :- [root@localhost ~]# ls <options> <arguments>

2) LS COMMANDS:

Listing of files and directories along with the inode numbers :-[root@localhost ~]# ls -il

Shows the list of files in Tree structure :-[root@localhost~]# ls -R <directory>

Listing of the attributes of a particular file or directory :-root@localhost~]# ls -ld <directory>

By using three methods we can create files

cat command

touch command

vi editor

3) Displaying & Creating Text Files :-root@localhost~]# cat <options> <arguments>


4) CAT COMMAND:
To create a file :- root@localhost ~]# cat > <filename>
To view the content of a file :-root@localhost~]# cat <filename>
To append a file :- root@localhost~]# cat >> <filename>
To transfer the contents of file1 & file2 to file3 :-[root@localhost~]# cat <file1> <file2> >>
<file3>
5) TOUCH COMMAND:
To create a file with zero bytes as well as to change the time stamp of file or directory.
[root@localhost~]# touch <filename>
To create multiple files :- root@localhost~]# touch <file1> <file2> <file3>
6) CREATING DIRECTORIES:
To create a directory :-root@localhost~]# mkdir <directory name>

To create multiple directories :-root@localhost~]# mkdir <dir1> <dir2> <dir3>

To create nested directories :-root@localhost~]# mkdir -p <dir1>/<dir2>/<dir3>


7) NAVIGATION OF DIRECTORIES:
To change the directory :-[root@localhost~]# cd <path of the directory>

To change directory one level back :-root@localhost~# cd ..

To change directory two levels back :-root@localhost~]# cd ../..

To change directory to last working directory :- [root@localhost ~]# cd -


8) REMOVING A FILE OR DIRECTORY:
To remove a file :-[root@localhost~]# rm <filename>

To remove empty directory :-[root@localhost ~]# rmdir <directory name>

To remove empty directory :-[root@localhost ~]# rmdir <directory name>

To remove directory recursively and forcefully :-[root@localhost ~]# rm -rf <directory name>
9) COPYING A FILE OR DIRECTORY:
To copy a file :-[root@localhost ~]# cp <source file path> <destination file path>

To copy a directory :-[root@localhost~]# cp -r <source dir path> <destination dir path>


10) MOVING/RENAMING A FILE OR DIRECTORY:
To move a file/dir to a different location :-[root@localhost ~]# mv <source path> <destination
path>
To rename file/dir move at same location :-[root@localhost~]# mv <old name> <new name>
VI EDITOR

EDITORS:
Editors are used for inserting or deleting text.
Various editors on different platforms:
Windows : Notepad
Linux/Unix :-CLI based : EX , ED , VI and GUI based : Emacs, Gedit, nedit, nano, pico
VI EDITORS MODES:
There are three modes of operations in VI Editor :
Insert Mode.
Command Mode .
Execute Mode.

HOW TO GET INTO INSERT MODE?


i - inserts the text at current cursor position.
I - inserts the text at beginning of line.
a - appends the text after current cursor position.
A - appends the text at end of line.
o - inserts a line below current cursor position.
O - inserts a line above current cursor position.
r - replace a single char at current cursor position.
AT EXECUTEs MODE:

q - quit without saving

q! - quit forcefully without saving

w save

wq - save & quit

wq! - save & quit forcefully


Basic networking Commands
1) who :- unix system are used by multiple users at a single time. If we want to know that who is
currently using the system then who command is used.
2) Ps command:- It is used to see the running process of the system.
3)Exit command :- it is used to signing off from the login.
4)Command whatis :- whatis command gives the information about the command. Command man also
gives the information about the command.

5) date command :- It shows the current date of system.

6) Command Who am i :- This command gives the current user who invoked the command.

7) command ping :- The ping command sends echo requests to the host you specify on the command
line, and lists the responses received their round trip time.

You simply use ping as: ping ip_or_host_name

Note to stop ping (otherwise it goes forever) use CTRL-C (break).

8) Command traceroute :-
It will show the route of a packet. It attempts to list the series of hosts through which your packets travel
on their way to a given destination.
Command syntax: traceroute machine_name_or_ip

9) command ifconfig :-

This command is used to configure network interfaces, or to display their current configuration. I
Use ifconfig as either: ifconfig

10) command ssh :-

ssh hostname :-Connect to a remote system with your current username, you will obviously need the
password of the user on the other machine.
ssh username@hostname :-Connect to a remote system with your a different username, you will
obviously need the password of the user on the other machine.
11) Command hostname :-Hostname command is used to view the hostname of the machine

12) Command ss and netstat : - ss command is a replacement for netstat. You can still use netstat
command on all systems. Using ss command, you can get more information than netstat command. ss
command is fast because it gets all the information from the kernel userspace.

The ss command will list all the TCP, UDP and Unix socket connections on your machine.

13) Command route :- This command gives detail of the root table of machine.

14) Command finger :- this command is used to view the user information.

15)Command telnet:- This command is used to communicate with another host.

Conclusion: Hence we have studied different commands in linux networking.

Das könnte Ihnen auch gefallen