- cal : Prints an ASCII calendar of the given month or year.
- date : Displays the current date and time.
- echo : Displays lines of text or string which are passed as arguments on the command line.
- clear : Brings the command line on top of the computer terminal.
- script : Makes typescript or records all the terminal activities.
- ls : Lists directory contents of files and directories.
- who : Prints information about users who are currently logged in.
- whoami : Allows Linux users to see the currently logged-in user.
- tty : Any terminal on Linux/Unix systems.
- uname & uname -r : displays the information about the system. Option -r displays the Linux kernel release info.
- cd (change directory) : Used to move efficiently from the current working directory to different directories in our System.
- mkdir : Creates multiple directories in the current location.
- rmdir : Removes the directory, specified by the Directory parameter, from the system.
- rm -r : It will recursively delete a directory and all its contents.
- man : Used to display the user manual of any command that we can run on the terminal.
- ls options :
- ls -l : Displays the contents of the current directory in a long listing format, one per line (show permissions).
- ls -a : Lists all files including hidden files (files with names beginning with a dot).
- ls -author : Lists the contents in the specified directory along with its owner.
- ls -C : Lists entries by columns.
- ls -d : Lists directories - with ' */'.
- ls -r : It is used to print the list in reverse order.
- file creation through cat command :
- cat > (to overwrite)
- cat >> (to append)
- cat (to view)
- Empty file creation using touch command.
- cp : cp stands for a copy. This command is used to copy files or groups of files or directories.
- mv : Moves files and directories from one directory to another or renames a file or directory.
- file : Used to determine the type of a file.
- wc command : (stands for word count)
- wc -l : Prints the number of lines in a file.
- wc -w : Prints the number of words in a file.
- wc -c : Displays the count of bytes in a file.
- wc -m : Prints the count of characters from a file.
- wc -L : Prints only the length of the longest line in a file.
- cmp : Used to compare two files byte by byte and helps to find out whether the two files are identical or not.
- comm : Compares two sorted files line by line and writes to standard output; the lines that are common and the lines that are unique.
- sort : Prints the lines of its input or concatenation of all files listed in its argument list in sorted order.
- redirection operator >
- rm -i for interactive deletion of any file.
- character class :
- ????? placeholders
- asterisks(**) to denote all
- chmod (change mode) :
- relative permission : ('+' symbol is used add and '-' symbol is used to remove a specific permission from user , group or others.)
- using ±r or ±w or ±x with ugo or a. ( 'a' stands for all , i.e., 'u'(user), 'g'(group) & 'o'(others). )
- using ugo/a = ±r or ±w or ±x.
- absolute permission using numbers :
- 4 : read (r--)
- 2 : write (-w-)
- 1 : execute (--x)
- 3 (2+1) : write & execute (-wx)
- 5 (4+1) : read & execute (r-x)
- 6 (4+2) : read & write (rw-)
- 7 (4+2+1) : read, write & execute (rwx)
- relative permission : ('+' symbol is used add and '-' symbol is used to remove a specific permission from user , group or others.)
- chmod -R : To assign same permissions of root directory to sub-directories.
- umask : The umask command sets the file-creation mask using this format:
- where mask is an octal number or symbolic value that correspond to the permissions to be disabled.
- This umask command adds write permission to the group:
- With no arguments, umask displays the current value.
- ls -ls
- redirection of output using > and >>
- Character class :
- [0-9] for digits (same as [!a-z]).
- [a-z] for chars (same as [!0-9]).
- Linux- Vi Editor (it has three modes of operation) :
- Command mode : Operations such as cut, copy, paste, delete, undo, redo etc.
- Insert mode : Type in new text.
- Esc mode : Extended commands for saving, exiting, search-and-replace can executed here.
- vi to open a file.
- Input Mode Commands :
- i : Insert text to left of the cursor(Existing text shifted right).
- a : Append text to right of cursor(Existing text shifted right).
- I : Insert text at the beginning of line.
- A : Append text at the end of the line.
- o : Open line below.
- O : Open line above
- rch : Replaces single character under cursor with ch.
- R : Replaces text from cursor to right.
- s : Replaces single character under cursor with any number of characters.
- S : Replaces entire line.
- grep command in pattern matching :
- grep -v : Selects the non-matching lines of the provided input pattern.
- grep -e : Union two grep patterns.
- grep -n : Prefix each line of the matching output with the line number in the input file.
- grep -c : Count number of lines matching to given pattern.
- grep -i : Ignores case distinctions in patterns and input data.
- grep "^pattern" (find specified pattern at the beginning).
- grep "pattern$" (find specified pattern at the end).
- grep "pattern1" |grep "pattern2" (pipe operator redirection used).
-
/dev/null (special file of linux that has size of 0 bytes it's works like insularator)
-
/dev/tty (represent the own terminal)
-
| (pipe command)
-
( ls | wc -l who |wc -l )
-
tee
-
ls |tee file
-
Command Substitution {`}
-
echo "Number of files are {`ls |wc -l } in present directorty"
-
Shell Variables
-
$x
-
expr $x + $y
-
expr $x - $y
-
expr $x * $y
-
expr $x / $y
-
exit status of last command echo $? ( 0 -- for successful 1 -- for i=unsuccessful )
-
x=20;y=30;z=40;m=20
-
test $x -eq
$y;echo $ ? (equals) -
test $x -ne
$y;echo $ ? (not equals) -
test $x -gt
$y;echo $ ? (greater than) -
test $x -lt
$y;echo $ ? (less than) -
test $x -ge
$y;echo $ ? (greater than or equals to) -
test $x -le
$y;echo $ ? (less than or equals to) -
who|tee /dev/tty|wc -l
-
ls |tee /dev/tty|grep -l "poem" *|wc -l >count
-
cat file>file (earse all the content of file)
- process command ps
- ps - l
- ps -f (full screen )
- ps -e (all process )
- kill process_id
- kill -9 process_id (super kill)
- & (at the end of command to make it background process)
- process scheduling
- at (for one time scheduling)
- batch
- crontab