1. DATE COMMAND
-----------------------------------
date +%<option> date "+%m %y"
m month numeric (output 08)
h momth Character (output Aug)
d The day of the month (output 1 to 31 date)
D The date in the formate(mm/dd/yy) (output month\day\year)
T The Time in the format hh:mm:yy (output 18:25:37)
y The last two digits of the year
H Hours
M Minute
S Second
Y full year (output 2011)
2. LIST COMMAND
---------------------------------
ls -<option>
a All filenames including those beginning with a dot
d Only filenames beginning with a dot.
i Inode number unic identity
l Long listing in ASCII collating sequance
L First text file after folder ascending order
r Sort filename in reverse order(ASCII collating sequence by default)
s Total size of file with file name
t Filenames sorted by last modification time
u Filenames sorted by last accrss time
e Owner read write pamutable
x Multicolumnar output
F Marks executable with *,directories with / and symbolic links with @
lt Sorts listing by last modification time
lu Sorts by ASCII collating sequence but listing shows last access time
lut As above but sorted by last access time
others
etc Filenames in/etc
-d /etc Only /etc
-ld /etc Listing of /etc
-ls lRa Recursive listing of all filename in file system
3. WHO COMMAND
----------------------------------
who current users name
whoami current pc
who -<option>
H heading
u idle time of pc
4. CAL COMMAND //CALENDER
---------------------------------
cal <option>
cal current month calender
cal current month calender
cal 2010 specific year cal.
cal 08-2011 specific month
5. PS COMMAND //VIEWING PROCESSES
------------------------------
ps display the process owner
Note := you can use - or not both are same output.
ps -<option>
l Long listing showing memory-related information
u username
u urs Processes of user usr only
a how many users online or Processes of all usera excluding processes not associated with terminal
f Full listing showing the PPID of each process
e or A All processes including user and system processes
aux Display filename and folder
t Processes running on terminal term(say/dev/console) or term or filename
6. WC COMMAND //WORD COUNT
-------------------------------
wc Counting Lines, Words and Characters
wc -<option>
l Number of Lines
w Number of words
c Number of characters
l < filename
ls | wc -l folder and file count
7. CAT COMMAND
---------------------------------
cat > filename (creat file name)
cat filename (open file)
cat -v Displaying nonprinting Character
cat -n Number of line
8. UNAME COMMAND
----------------------------------------
uname or unemw -s Display the name of the operating System
uname -r Disply the virson operating system
uname -n The first word of the domain name
a Display all details and You can use the -an,-as and -ar
9. PWD(present working directory)COMMAND
-----------
pwd Displys the absolute pathname
10. MKDIR COMMAND //MAKING DIRECTORIES
--------------------------------------
mkdir Create New Directory in Specific Drive
mkdir veer data data1 this command will create individual directory
mkdir veer veer/data veer/data1 this command generate tree as below
veer
/\
/ \
/ \
Data Data1
11. RMDIR COMMAND //REMOVING DIRECTORIES
---------------------------------------
rmdir <file name> Removing file
rmdir veer veer/data veer/data1 Actually this command Remove Child Directories but Parent directory remain as it's
rmdir veer/data veer/data veer This command Remove parent and child directory
12. CD COMMAND //CHANGE DIRECTORIES
------------------------------
cd Display the main directories // home/owner
cd . this represents the current directory
cd .. this represents the parent directory or move one level up
cd ./filename Add the child directories
cd ../.. Move two level up
13. CP COMMAND //COPY
----------- -------------------
cp <Firstfilename Secondfilename> the first is copied to the second
cp -i <Firstfilename Secondfilename> //INTERACTIVE COPY
cp -R <Firstfilename Secondfilename> //RECURVELY TO COPY OR COPY DIRECTORIES STRUCTURES
//overwrite yes / no
14. RM COMMAND //REMOVE FILE
-------------------------------
rm * Remove all Files
rm -<option>
i Interactive Deletion //user for confirmtion before each file
r or R Recursive Deletion
r * Behaves partially like rmdir
f Forcfully Remove files
rf * Delete everything in the current directory
15. MV COMMAND // MOVE FILE
-------------------------------
mv command have two points
1. It renames file or directory
2. It moves a group of file to file to different directory
mv <files move> to <file> //MOVE
mv <old filename> <new filename> //RENAME
16. DIFF COMMAND // CONVERTING ONE FILE TO OTHER
------------------------------------
diff <first filename> <second filename>
17. CHMOD COMMAND //CHANGING FILE PERMISSIONS
-----------------------------------
ls -l <filename> Display permission
chmod <option> <filename>
l file need to be change
u user
o Other
a All(ugo)
+-- Assigns premission
--- Removes permission
=-- Assigns absoulute permission
666 Read and Write permission
r Read permission
w write permission
x Execute permission
644 To assign all pemission tothe owner read and write permission
To the group and omly executepermission to other use this
000 All permission are remove
777 Granted all permission
R Recursively
-R 755 Works on hidden files
_R a+x Leaves out hidden files
18. GREP COMMAND //SEARCHING FOR A PATTERM
----------------------------------
grep <argument> <filename> [<second filename>]
grep -<pattern> <filename> .* All line display
grep -<option>
i Ignores case for matching
v Doesn't display line matching expression
n Display line number along with lines
c Display count of numbers of occurrences
l Display list of filenames only
e exp Specifies expression with this option Can use multiple times Also use for
matching expression beginning with a hyphen
x Matches pattern with entire line
f Takes patterns from file one per line it need to second filename
E Treats pattern as an extended regular expression (ERE)
F Matches multiple fixed string
19. Different Command
----------------------------------
grep "[small letter and Capital letter] " <filename>
eg. grep "v[iI]j[aA]y" list
*
eg. grep "v[iI]j*[aA]y" list
grep "^v" list Display Starting character v
grep "^[^a]" list Anywhere "a" than this record should display
grep "a...$" Specifices position "a" this record should display
ls -l | grep "^d" Shows only directories
grep -E '(vi|a)jay' list
output
vijay
ajay // sanjay can't be display
grep -E '(jamnagar|rajkot)' list
20. SED COMMAND // STREAM EDITOR
--------------------
sed '3q' list First three Record display here q = Quit
sed -n '1,2p' list First two line display here p= print
sed -n '$p' list Display last line
sed -n '3,$p' list Don't print lines 3 to end
sed -n '/jamnagar/p' list Display specific place or /jamnagar/,/rajkot/
21. DELETE USING SED COMMAND
-------------------------------------------------------------
sed '/jamnagar/d' list
sed 'v/|/:/' list1
22. HEAD COMMAND
----------------------------------
head -n 3 list First three line display
head -n 5 list | tee list1 list file is empty
23. TAIL COMMAND
--------------------------------
tail -n 3 list Last three line display
tail +5 list First four line skeep
tail -c -512 list Copies last 512 bytes from list
tail -c +512 list Copies everything afterskipping 511 byte
24. CUT COMMAND
---------------------
cut -<option>
c <specific character no.> To extract Cut the specific columns
eg. cut -c 2-3 list
d
f
using cut command then copy another file
cut -d \| -f 2.3 slist | tree list1
25. PASTE COMMAND
-----------------------------------
paste <oldfilename> <newfilename>
paste -d "|" <old filenae> <new filename>
paste -s -d "||\n" list
output
vijay |jay |pankaj
jignesh |rahul |amit as it's
26. SORT COMMAND
----------------------------------
sort -<option>
tchar Uses delimiter char to identify fields
k n Sort on nth field
k m,n Start sort on "m"th field and ends sort on "n"th field
k m.n Start sort on "n"th column of "m"th fiels
u Removes repeated line
n Sorts numerically
r Reverses sort order
f Folder lowercase to equivalent uppercase (case insensitive sort)
m list Merges sorted files in list
c Checks if file is sorted
o flname Places output in file flname
27. FIND COMMAND
--------------------------------
find -name "*.txt" -print All files extension
find -name '[A-Z]' -print Single quates will also do
cd; find . -type d -print 2>/dev/null shows the . also Display hidden directories also
find -mtime -2 -print Display list of file and folder
find -<operation>
find . ! -name "*.txt" -print Select all text file
-inum n Having inode number n
-type x If of type x,x can be f(ordinary file).d (directory) or l(symbolic link)
-type f if an ordinary file
-perm nnn If octal permission match nnn completely
-link n If having n link
-user usname If owned by usname
-group gname If owned by group gname
-size +x[c] If size greater than blocks (characters if c is also specified)
-mtime -x If modified in less than x days
-newer flnmae If modified after flnmae
-mmin -x If modified in less than x minutes (Linux only)
-atime +x If accessed in more than x days
-aminv+x If accessed in more than x minutes (Linux only)
-name flnmae Flname
-iname flname As above but match is case-insensitive(Linux only)
-follow After following a symbolic link
-prune But don't desend directory if matched
-mount But don't look in other file system
28. PASSWD COMMAND
--------------- ------------------------
passwd password changing
-----------------------------------
date +%<option> date "+%m %y"
m month numeric (output 08)
h momth Character (output Aug)
d The day of the month (output 1 to 31 date)
D The date in the formate(mm/dd/yy) (output month\day\year)
T The Time in the format hh:mm:yy (output 18:25:37)
y The last two digits of the year
H Hours
M Minute
S Second
Y full year (output 2011)
2. LIST COMMAND
---------------------------------
ls -<option>
a All filenames including those beginning with a dot
d Only filenames beginning with a dot.
i Inode number unic identity
l Long listing in ASCII collating sequance
L First text file after folder ascending order
r Sort filename in reverse order(ASCII collating sequence by default)
s Total size of file with file name
t Filenames sorted by last modification time
u Filenames sorted by last accrss time
e Owner read write pamutable
x Multicolumnar output
F Marks executable with *,directories with / and symbolic links with @
lt Sorts listing by last modification time
lu Sorts by ASCII collating sequence but listing shows last access time
lut As above but sorted by last access time
others
etc Filenames in/etc
-d /etc Only /etc
-ld /etc Listing of /etc
-ls lRa Recursive listing of all filename in file system
3. WHO COMMAND
----------------------------------
who current users name
whoami current pc
who -<option>
H heading
u idle time of pc
4. CAL COMMAND //CALENDER
---------------------------------
cal <option>
cal current month calender
cal current month calender
cal 2010 specific year cal.
cal 08-2011 specific month
5. PS COMMAND //VIEWING PROCESSES
------------------------------
ps display the process owner
Note := you can use - or not both are same output.
ps -<option>
l Long listing showing memory-related information
u username
u urs Processes of user usr only
a how many users online or Processes of all usera excluding processes not associated with terminal
f Full listing showing the PPID of each process
e or A All processes including user and system processes
aux Display filename and folder
t Processes running on terminal term(say/dev/console) or term or filename
6. WC COMMAND //WORD COUNT
-------------------------------
wc Counting Lines, Words and Characters
wc -<option>
l Number of Lines
w Number of words
c Number of characters
l < filename
ls | wc -l folder and file count
7. CAT COMMAND
---------------------------------
cat > filename (creat file name)
cat filename (open file)
cat -v Displaying nonprinting Character
cat -n Number of line
8. UNAME COMMAND
----------------------------------------
uname or unemw -s Display the name of the operating System
uname -r Disply the virson operating system
uname -n The first word of the domain name
a Display all details and You can use the -an,-as and -ar
9. PWD(present working directory)COMMAND
-----------
pwd Displys the absolute pathname
10. MKDIR COMMAND //MAKING DIRECTORIES
--------------------------------------
mkdir Create New Directory in Specific Drive
mkdir veer data data1 this command will create individual directory
mkdir veer veer/data veer/data1 this command generate tree as below
veer
/\
/ \
/ \
Data Data1
11. RMDIR COMMAND //REMOVING DIRECTORIES
---------------------------------------
rmdir <file name> Removing file
rmdir veer veer/data veer/data1 Actually this command Remove Child Directories but Parent directory remain as it's
rmdir veer/data veer/data veer This command Remove parent and child directory
12. CD COMMAND //CHANGE DIRECTORIES
------------------------------
cd Display the main directories // home/owner
cd . this represents the current directory
cd .. this represents the parent directory or move one level up
cd ./filename Add the child directories
cd ../.. Move two level up
13. CP COMMAND //COPY
----------- -------------------
cp <Firstfilename Secondfilename> the first is copied to the second
cp -i <Firstfilename Secondfilename> //INTERACTIVE COPY
cp -R <Firstfilename Secondfilename> //RECURVELY TO COPY OR COPY DIRECTORIES STRUCTURES
//overwrite yes / no
14. RM COMMAND //REMOVE FILE
-------------------------------
rm * Remove all Files
rm -<option>
i Interactive Deletion //user for confirmtion before each file
r or R Recursive Deletion
r * Behaves partially like rmdir
f Forcfully Remove files
rf * Delete everything in the current directory
15. MV COMMAND // MOVE FILE
-------------------------------
mv command have two points
1. It renames file or directory
2. It moves a group of file to file to different directory
mv <files move> to <file> //MOVE
mv <old filename> <new filename> //RENAME
16. DIFF COMMAND // CONVERTING ONE FILE TO OTHER
------------------------------------
diff <first filename> <second filename>
17. CHMOD COMMAND //CHANGING FILE PERMISSIONS
-----------------------------------
ls -l <filename> Display permission
chmod <option> <filename>
l file need to be change
u user
o Other
a All(ugo)
+-- Assigns premission
--- Removes permission
=-- Assigns absoulute permission
666 Read and Write permission
r Read permission
w write permission
x Execute permission
644 To assign all pemission tothe owner read and write permission
To the group and omly executepermission to other use this
000 All permission are remove
777 Granted all permission
R Recursively
-R 755 Works on hidden files
_R a+x Leaves out hidden files
18. GREP COMMAND //SEARCHING FOR A PATTERM
----------------------------------
grep <argument> <filename> [<second filename>]
grep -<pattern> <filename> .* All line display
grep -<option>
i Ignores case for matching
v Doesn't display line matching expression
n Display line number along with lines
c Display count of numbers of occurrences
l Display list of filenames only
e exp Specifies expression with this option Can use multiple times Also use for
matching expression beginning with a hyphen
x Matches pattern with entire line
f Takes patterns from file one per line it need to second filename
E Treats pattern as an extended regular expression (ERE)
F Matches multiple fixed string
19. Different Command
----------------------------------
grep "[small letter and Capital letter] " <filename>
eg. grep "v[iI]j[aA]y" list
*
eg. grep "v[iI]j*[aA]y" list
grep "^v" list Display Starting character v
grep "^[^a]" list Anywhere "a" than this record should display
grep "a...$" Specifices position "a" this record should display
ls -l | grep "^d" Shows only directories
grep -E '(vi|a)jay' list
output
vijay
ajay // sanjay can't be display
grep -E '(jamnagar|rajkot)' list
20. SED COMMAND // STREAM EDITOR
--------------------
sed '3q' list First three Record display here q = Quit
sed -n '1,2p' list First two line display here p= print
sed -n '$p' list Display last line
sed -n '3,$p' list Don't print lines 3 to end
sed -n '/jamnagar/p' list Display specific place or /jamnagar/,/rajkot/
21. DELETE USING SED COMMAND
-------------------------------------------------------------
sed '/jamnagar/d' list
sed 'v/|/:/' list1
22. HEAD COMMAND
----------------------------------
head -n 3 list First three line display
head -n 5 list | tee list1 list file is empty
23. TAIL COMMAND
--------------------------------
tail -n 3 list Last three line display
tail +5 list First four line skeep
tail -c -512 list Copies last 512 bytes from list
tail -c +512 list Copies everything afterskipping 511 byte
24. CUT COMMAND
---------------------
cut -<option>
c <specific character no.> To extract Cut the specific columns
eg. cut -c 2-3 list
d
f
using cut command then copy another file
cut -d \| -f 2.3 slist | tree list1
25. PASTE COMMAND
-----------------------------------
paste <oldfilename> <newfilename>
paste -d "|" <old filenae> <new filename>
paste -s -d "||\n" list
output
vijay |jay |pankaj
jignesh |rahul |amit as it's
26. SORT COMMAND
----------------------------------
sort -<option>
tchar Uses delimiter char to identify fields
k n Sort on nth field
k m,n Start sort on "m"th field and ends sort on "n"th field
k m.n Start sort on "n"th column of "m"th fiels
u Removes repeated line
n Sorts numerically
r Reverses sort order
f Folder lowercase to equivalent uppercase (case insensitive sort)
m list Merges sorted files in list
c Checks if file is sorted
o flname Places output in file flname
27. FIND COMMAND
--------------------------------
find -name "*.txt" -print All files extension
find -name '[A-Z]' -print Single quates will also do
cd; find . -type d -print 2>/dev/null shows the . also Display hidden directories also
find -mtime -2 -print Display list of file and folder
find -<operation>
find . ! -name "*.txt" -print Select all text file
-inum n Having inode number n
-type x If of type x,x can be f(ordinary file).d (directory) or l(symbolic link)
-type f if an ordinary file
-perm nnn If octal permission match nnn completely
-link n If having n link
-user usname If owned by usname
-group gname If owned by group gname
-size +x[c] If size greater than blocks (characters if c is also specified)
-mtime -x If modified in less than x days
-newer flnmae If modified after flnmae
-mmin -x If modified in less than x minutes (Linux only)
-atime +x If accessed in more than x days
-aminv+x If accessed in more than x minutes (Linux only)
-name flnmae Flname
-iname flname As above but match is case-insensitive(Linux only)
-follow After following a symbolic link
-prune But don't desend directory if matched
-mount But don't look in other file system
28. PASSWD COMMAND
--------------- ------------------------
passwd password changing
No comments:
Post a Comment