Comprehensive Exploration of Linux Commands
Comprehensive Exploration of Linux Commands
1. ls- Show list of all files and directory(folders) inside current directory
2. pwd-Print working directory
3. mkdir- Creating directory (mkdir folder)
4. mkdir aa bb cc dd – for multiple folders
5. cd – Change directory (cd folder)
6. cd .. – one step back/one step up/ go to parent folders
7. cd – for home directory
8. clear- clear screen
9. mkdir –p one/two/three –create folder one inside two
10. ls two- we can check list of inside the that folder
11. (cd -) – Previous location like backspace button
12. ls –l = show list with long details
13. history= see the previous command
14. whoami- define which user
15. man = details of any command (man ls)
16. ls –a = see hidden any file
17. ls –al = see hidden file with details
18. rm filename= for delete file
19. rm –r foldername= for delete directory
20. rmdir foldername= for delete only empty directory
21. head file.txt = print first 10 lines of file
22. head –n file.txt= print first(any number) lines of file
23. tail file.txt= print last 10 lines of file
24. tail –n file.txt= print last(any number) lines of file
25. wc file.txt= number of line, number of words, file size in bites
26. uname = os name
27. df –h =hard disk usage information
28. free –m = for RAM space
29. du –h filename/foldername = file and folder space
30. lsblk= list of disk attached with partition
31. yum install softwarename= install software
32. ping IP/domainname= for check connectivity of server
Create file
1. touch
- Create empty file
- Can’t read/write/modify
touch filename
- touch myfile.txt
- touch –m filename (time modify)
2. cat
- Create file
- Read access
- Write access
- Cannot modify
- Nano filename
- For save- ctl+c and y
4. Vi/vim
- Create file
- Read access
- Write access
- Modify file
- i/a/c = insert
- Esc :wq! For save
- Esc :q! for not save changes
- Vi filename
- vim filename
Rwx=7
Chmod 754 filename.txt (for change file permission)
Chmod -r 754 myfolder (for change directory permission)
—------------
cp source destination
cp myfile.txt myfolder/myfile.txt
cp myfile.txt myfolder
cp myfile.txt myfolder/
cp -r yourfolder/home/ec2-user/
cp -r myfolder yourfile.txt
mv source destination
mv myfile.txt myfolder
mv myfile.txt myfolder/
mv myfile.txt myfolder/myfile.txt
mv myfile.txt myfolder/yourfile.txt
ownership
amazon-linux-extras list
Apache in ubuntu
Nginx in ubuntu
sudo apt-get install nginx
sudo service nginx start
or
sudo yum install php
sudo service php-fpm start
sudo service php-fpm status
sudo service php-fpm stop