0% found this document useful (0 votes)
27 views4 pages

Unix/Linux Command Reference: File Commands

Uploaded by

dmybook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Unix/Linux Command Reference: File Commands

Uploaded by

dmybook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unix/Linux Command Reference

File Commands
1. ls Directory listing
2. ls -al Formatted listing with hidden files
3. ls -lt Sorting the Formatted listing by time modification
4. cd dir Change directory to dir
5. cd Change to home directory
6. wd Show c!rrent wor"ing directory
#. m"dir dir Creating a directory dir
$. cat %file &laces the standard in!t into the file
'. more file (!t!t the contents of the file
1). head file (!t!t the first 1) lines of the file
11. tail file (!t!t the last 1) lines of the file
12. tail -f file (!t!t the contents of file as it grows*starting with
the last 1) lines
13. to!ch file Create or !date file
14. rm file Deleting the file
15. rm -r dir Deleting the directory
16. rm -f file Force to remo+e the file
1#. rm -rf dir Force to remo+e the directory dir
1$. c file1 file2 Coy the contents of file1 to file2
1'. c -r dir1 dir2 Coy dir1 to dir2,create dir2 if not resent
2). m+ file1 file2 -ename or mo+e file1 to file2*if file2 is an [Link]
directory
21. ln -s file lin" Create symbolic lin" lin" to file
&rocess management
1. s /o dislay the c!rrently wor"ing rocesses
2. to Dislay all r!nning rocess
Unix/Linux Command Reference
3. "ill id 0ill the rocess with gi+en id
4. "illall roc 0ill all the rocess named roc
5. "ill attern 1ill "ill all rocesses matching the attern
6. bg 2ist stoed or bac"gro!nd 3obs*res!me a stoed
3ob in the bac"gro!nd
#. fg 4rings the most recent 3ob to foregro!nd
$. fg n 4rings 3ob n to the foregro!nd
File ermission
1. chmod octal file Change the ermission of file to octal*which can
be fo!nd searately for !ser*gro!*world by
adding*
4-read5r6
2-write5w6
[Link]!te5.6
Searching
1. gre attern file Search for attern in file
2. gre -r attern dir Search rec!rsi+ely for attern in dir
3. command 7 gre
attern
Search attern in the o!t!t of a command
4. locate file Find all instances of file
5. find . -name filename Searches in the c!rrent directory 5reresented by
a eriod6 and below it* for files and directories with
names starting with filename
6. gre attern Searches for all the named rocesses * that
matches with the attern and* by defa!lt* ret!rns
their 8D
System 8nfo
1. date Show the c!rrent date and time
2. cal Show this month9s calender
3. !time Show c!rrent !time
4. w Dislay who is on line
5. whoami 1ho yo! are logged in as
Unix/Linux Command Reference
6. finger !ser Dislay information abo!t !ser
#. !name -a Show "ernel information
$. cat :roc:c!info C! information
'. cat roc:meminfo ;emory information
1). man command Show the man!al for command
11. df Show the dis" !sage
12. d! Show directory sace !sage
13. free Show memory and swa !sage
14. whereis a Show ossible locations of a
15. which a Show which alications will be r!n by defa!lt
Comression
1. tar cf [Link] file Create tar named [Link] containing file
2. tar .f [Link] <.tract the files from [Link]
3. tar c=f [Link].g= files Create a tar with >=i comression
4. tar .=f [Link].g= <.tract a tar !sing >=i
5. tar c3f [Link].b=2 Create tar with 4=i2 comression
6. tar .3f [Link].b=2 <.tract a tar !sing 4=i2
#. g=i file Comresses file and renames it to file.g=
$. g=i -d file.g= Decomresses file.g= bac" to file
?etwor"
1. ing host &ing host and o!t!t res!lts
2. whois domain >et whois information for domains
3. dig domain >et D?S information for domain
4. dig -. host -e+erse loo"! host
5. wget file Download file
6. wget -c file Contin!e a stoed download
Unix/Linux Command Reference
Shortc!ts
1. ctrl@c Aalts the c!rrent command
2. ctrl@= Stos the c!rrent command* res!me with fg in the
foregro!nd or bg in the bac"gro!nd
3. ctrl@d 2ogo!t the c!rrent session* similar to [Link]
4. ctrl@w <rases one word in the c!rrent line
5. ctrl@! <rases the whole line
6. ctrl@r /ye to bring ! a recent command
#. BB -eeats the last command
$. [Link] 2ogo!t the c!rrent session
Unix/Linux Command Reference

You might also like