Basic Linux Command
1. tty
2. whoami
3. which
4. echo
a. echo $PATH
b. echo $PWD
c. echo $OLDPWD
d. echo $? – to check success or not of operation command linux if result is 0 success if 1 not success
5. set
6. clear
7. reset
8. history
a. !780 – executes command under history
b. ~user : is a home directory user
9. pwd
10. cd
a. cd with no option is a changes to $HOME dorectory
b. cd ~ changes to $HOME directory
c. cd / changes to root file system
d. cd Desktop/ changes to relative directory
e. cd ..
f. cd ../..
11. Arrow keys (up and down) to know history command
12. BASH support tab completion
13. You can copy  and paste in GNOME terminal using
a. left button to block
b. right button to paste or Ctrl Shift V
14. ls – list directory
a. ls / – list of content of directory
b. ls -l list directory in long format
c. ls -ld /etc
d. ls -ltr
e. ls — help
f. ls -a – to list hidden file or directory (. is symbol of hidden )
15. cat – catenates files
a. cat  123.txt – dump of contents of 123.txt to STDOUT
b. cat 123.txt 456.txt dump both files to STDOUT
c. cat 123 456 > 123456 = create new catenated files
16. mkdir – create new directory
a. mkdir test
17. cp – copies files
a. cp 123.txt test/ : copies file 123.txt to directory test
b. cp -v 345.txt test/ : copies file to directory test with verbose mode
18. mv – move files
a. mv 123456.txt test/ : move files to directory test
19 . rm – remove files or directory
a. rm 123.txt
b. rm -rf 123.txt : remove recusifly and enforces
20. touch – creates blank file/updates timestamp
a. touch test.txt , if it doesn’t exist
b. touch 123456.txt if exist will bo update timestamp
c. touch -t 201101290100 123456.txt will be changes timestamp
21. stat – reveals statistic of files
a. stat 123456.txt – reveal full attributes of the file
22. find – find file using patterns
a. find / -name ‘fstabs’
23. alias – returnt/sets aliases for command
a. alias – dumps current aliases
b. alias copy =’cp -v’

Linux Redirection and Pipes
Features :
1. Ability to control input and output
input redirection :
a. cat < 123.txt
output redirection ‘>’
a. cat 123.txt > onetwothree.txt
b. cat 123.txt >> number.txt : creates ‘number.txt’ if its doesn’t exist or append if it does

Pipes ‘|’
a. cat 123.txt  | sort
b. cat 456.txt 123.txt | sort
c. cat 456.txt 123.txt | sort | grep 3

Command Chaining
1. permit the execution of multiple commands in sqequence
2. also permit execution based on the success of failure of a previous command
a. cat 123.txt; ls -l
b. cat 123.txt && ls -l :  this run second command, if first command success
c. cat 1234.txt && ls -l :
d. cat 123.txt || ls -l : this run second command if first command fails

24. more | less : paginators, which display text one-page @ a time
a. more /etc/fstab

25. seq : echoes a sequence of nummbers
a. seq 1000 > erick.txt : create files erick.txt with number 1 – 1000
26. su – switch user
a. su – without option will login to user root
27. head – displays opening lines of text files
a. head /var/log/messages
28. tail – displays closing lines of text files
tail /var/log/messages
29. wc – word count
wc -l /var/log/messages
wc -l 123.txt
30 . file – determines file type
a. file /var/log/messages

Advertisements