Linux Commands‎ > ‎

Linux Commands 2

posted Oct 13, 2009, 12:53 AM by JR A

Directory Operations

Show current directory
Make directory dir
Change directory to dir
cd ..
Go up a directory
List files

ls Options

-a
Show all (including hidden)
-R
Recursive list
-r
Reverse order
-t
Sort by last modified
-S
Sort by file size
-l
Long listing format
-1
One file per line
-m
Comma-­sep­arated output
-Q
Quoted output

Search Files

Search for patternin files
grep -i
Case insens­itive search
grep -r
Recursive search
grep -v
Inverted search
grep -o
Show matched part of file only
Find files starting with name in dir
find /dir/ -user name
Find files owned by name in dir
find /dir/ -mmin num
Find files modifed less than numminutes ago in dir
Find binary / source / manual for command
Find file (quick search of system index)

File Operations

Create file1
Concat­enate files and output
View and paginate file1
Get type of file1
Copy file1 to file2
Move file1 to file2
Delete file1
Show first 10 lines of file1
Show last 10 lines of file1
Output last lines of file1 as it changes

Watch a Command

Issue the 'ntpq -p' command every 5 seconds and display output

Process Management

Show snapshot of processes
Show real time processes
Kill process with id pid
Kill process with name name
Kill all processes with names beginning name
Comments