Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
65 views

Linux Documentation

Linux is an open source operating system that manages hardware resources and sits between applications and hardware. It has a file system that handles data management and storage by arranging files on disk and tracking file metadata. There are two types of paths - absolute paths provide full details to locate a file starting from root, while relative paths start from the current directory. Common Linux commands include ls to list files, cd to change directories, mkdir to create directories, rm to remove files/directories, and cp to copy files.

Uploaded by

Ritesh Tripathi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Linux Documentation

Linux is an open source operating system that manages hardware resources and sits between applications and hardware. It has a file system that handles data management and storage by arranging files on disk and tracking file metadata. There are two types of paths - absolute paths provide full details to locate a file starting from root, while relative paths start from the current directory. Common Linux commands include ls to list files, cd to change directories, mkdir to create directories, rm to remove files/directories, and cp to copy files.

Uploaded by

Ritesh Tripathi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Linux

What is Linux

Linux is an open source operating system (OS). An operating system is the software that directly
manages a system's hardware and resources, like CPU, memory, and storage. The OS sits between
applications and hardware and makes the connections between all of your software and the physical
resources that do the work. In a simple word Linux is a Unix-like, open source and community-
developed operating system (OS) for computers, servers, mainframes, mobile devices and
embedded devices. It is supported on almost every major computer platform, including x86, ARM
and SPARC, making it one of the most widely supported operating systems.

What is Linux File System

Linux file system is generally a built-in layer of a Linux operating system used to handle the
data management of the storage. It helps to arrange the file on the disk storage. It manages
the file name, file size, creation date, and much more information about a file.

Directory Description
/(root file It contains all of the databases or folders or files.
system)
/bin User executable files.
/boot To boot Linux computer
/dev This is the directory contains the device files for every hardware device attached
to the system.
/etc Local system configuration file for the host computer
/home Each user has a subdirectory in /home
/lib Contains shared library files that are required to boot the system
/media A place to mount external removable device such as USB that may be connected
to the host
/mnt It’s a temporary mount point for a system while admin is working or repairing file
system
/opt Optional files such as vendor supplied application programs should be located
here
/root This is home directory for the root user
/sbin These are binary files and executable used for system administration
/tmp It is used to store temporary files
/user These are shareable , read only files, including executable binaries and libraries,
man files and other documentation.
/var Variable data files are stored here like MySQL, webserver date file etc.
There are two types of path variable:-

1.Absolute Path :
An absolute path refers to the complete details needed to locate a file or folder, starting from the
root element and ending with the other subdirectories. Absolute paths are used in websites and
operating systems for locating files and folders. An absolute path is also known as an absolute
pathname or full path.
2.Relative path :

Relative path is defined as the path related to the present working directly(pwd). It starts at your
current directory.

PROCESS STATE IN UNIX:

1. Running → process is running or ready to run.

2. Waiting → process is waiting for the resource.

3. Stoping → process has been stopped

4. Zombie → process is stopped but not remove from process table.

How to change directory or folder


pwd to check the current directory
cd Desktop to change the directory to Desktop
cd .. comeback to directory
cd ~ toggle between the directory

SOME INITIAL COMMANDS

Command Result
clear If you want clear the terminal
Logname for display the current user
tty for the current terminal
pwd To check the path
uptime Time of OS
uname Name of the OS
uname -p Processer of OS
uname -r Version of OS
uname -v Release date of OS
uname -n Host name of OS
uname -a Info of OS
uname -m Hardware name
hostname Ubuntu
hostname -a Alies name of Hostname
hostname -f Fully hostname
hostname -i IP address of the hostname
hostname -s Display the short
namewho Who connected to the server
who am i User
who -b System boot time
who -d Dead process
who -h Display heading
who -l Ideal time
who -u list of user login
w -V Display version
w Logged in avg load
cal calendar
exit To exit from the terminal
id –u To check the user id
id -g To check the group id

Useful command in Linux:


1. To check the current directories click ls and press enter

Output: bad delhi Downloads guru line.text prwatech Templates

2. if you want one by one then press ls -1 press enter

Output: delhi

Downloads

guru

line.text

prwatech

Templates

3. To list out all hidden objects , click ls -a press enter

Output . .cache Documents hydrabad Music .ssh

.. .config Downloads .ICEauthority Pictures .sudo_as_admin_successful

4. list of all hidden objects without (.) and (..) , click ls-A press enter
5. to check the details of directories , click ls -l press enter

6. To display the objects which are ends with “ / , @ , * , = ” , press ls -F press enter

7. To Clear the terminal type clear and press enter

8. To exit from the terminal type exit and press enter

9. To list out the object in reverse order , type ls -r , press enter

10. for getting the object in Recursive order , type ls -R , press enter

11. for getting objects w.r.t their modification time , type ls -t , press enter

12. for getting objects separated by comma , type ls -m , press enter

13. for getting list of objects in multiple columns , type ls -x , press enter

14. for getting list of objects with inode number , type ls -I , press enter

Output : 416170 bad 408070 Documents 416165 hydrabad 408072 Pictures 408360 test.txt

408142 data.text 408067 Downloads 416166 kerala 416163 prwatech 408073 Videos

15. to list out display in human readable format , type ls -h , press enter

16. To list out all the objects with 7 column formate w.r.t modification time(t) , type ls -lt , press
enter

17.for getting the objects with its size , type ls -s , press enter

Output:
4 bad 4 Desktop 4 good 4 line.text 4 prwatech 4 test.txt

4 data.text 4 Documents 4 guru 4 Music 4 Public 4 Videos

18. To list out all the objects w.r.t size (size in bits) , type ls -S , press Enter

19. To list out all the objects w.r.t their access time(u) , type ls -u , press enter

20. to list out all the objects in reverse order along with 7 column formative wrt modification time(t)

Press ls -lrt , press enter

21.for getting list of all the objects in reverse order along with w.r.t. theire access time(u)

Press ls -lru , press enter

22. for getting the list of all objects in reverse order along with their sizes , type ls -lrs , press enter

23. for getting list of all the objects with 7 column formate w.r.t. their id number and group id
number type ls -n , press enter

24.for getting all the objects and hidden file present in entire file system type ls -lar , press enter

CAT Command:

1. To create the new file in current directory , cat >test.txt

Note : - to return main directory after executing above command press ctrl+d.

2. for displaying the same content type cat test.txt or nl test.txt

3. In case you want to append the content type cat >>test.text , press enter then add what you
want to add.

4. for checking the number of lines in the content , type cat -n test.txt , press enter
5.for neglecting the blank (b) spaces and numbering the remaining lines type cat -b test.txt , press
enter

6.for dropping all the content from the file type cat test.txt>test.txt , press enter

7.for creating empty file type >test.txt press enter

8.for ending the content line with $ symbol type cat -e test.txt , press enter

9. for copying one file content to other file cat test.txt>new.txt , press enter

10. for appending the one files with another file content type cat test.txt>>start.txt, press enter

11. for adding one or more file to new file , type cat p.txt q.txt r.txt >w.txt

12. To squeeze the number of blank lines to one blank line cat -s line.txt and press enter
MKDIR COMMAND:

1. For creating the directory type mkdir ecotech , press enter

2. For creating simultaneously directory type mkdir delhi banglore hydrabad , press enter

3. For creating folder in directory without going inside it, type mkdir ecotech/office , press enter

4. for creating simultaneously two or more folder inside the folder in a single command type

mkdir office/ground floor office/first floor, press enter

5. If we don’t need any message after creating the directory then, type mkdir -p good or mkdir -pv
good or mkdir -v bad or mkdir -vp bad, press enter

6. if you want to give permission before modifying type mkdir -m421 week
Remove (RM) COMMAND:
1. for removing the file from the current directory type rm test.txt, press enter

2. To ask YES or NO permission before removing the file type rm -i numbers.txt

3. For removing the file completely type rm -rf test.txt or rm -f test.txt , press enter

NOTE: we can’t open directory using cat command, to open command we have to use cd <name>

4. For removing directory completely type rm -r delhi , press enter

5. For removing directory forcefully type rm -rf kerala

6. for removing all any extension type rm *.txt

7. for removing the all the objects from the directory type rm * and type enter

COPY (CP) COMMAND:


1. for overwrite the one file over another file type cp m.text n.text , press Enter

2. for copying one directory content to another directory type cp -r lin banglore , press enter

3. for asking for permission before overwriting the file type, cp -r new.text prwa.text, press enter

Type yes, for giving permission

No , for not to overwriting

4. if you want replace but want to keep your backup type , cp -r new.text prwa.text , press enter
Note: (new.text) is source

(prwa.text) is destination

5. if you want to overwrite without any modification time then type, cp -I backup.text siri.txt

MOVE COMMAND:

1.for moving the one file to another type mv prwa.txt lin, press enter

2. To rename file without changing modification time then type mv a.txt b.txt , press enter

3.for moving file and keeping a backup of it type mv a.text b.text , press enter

4. for asking permission before replacing or renaming the file mv -i nex.txt n.txt

Type yes, for giving permission

No , for not to overwriting

5.forcefully moving the file type , mv -f a.text b.text

6. for moving one directory to another mv delhi lin

7. for explaining what has been done mv -v layout lin


HEAD COMMAND:

1. To display first 10 line of the file type, head ipl.txt , hit enter

2. for displaying nth line in the file type, head -n corona.txt , hit enter

where n is number of rows you want.

3.for extracting middle lines from the file type , head -5 ipl.txt|tail-2 , hit the enter

4. To display the last 10 lines of the file type , tail corona.txt , hit the enter

5. To display last nth lines in the file type ,n corona.txt , hit the enter

where n is number of rows you want

6. To extract middle some lines from the file type ,tail -3 corona.txt|head -2, hit the enter

You might also like