1. Difference Between Unix and Linux
- UNIX is a multi-user and multi-tasking operating system while Linux is a UNIX-based operating system.
- Linux is open source and free to use; Unix is not open source and is an authorized operating system.
- Linux is used more widely from desktops, servers, smartphones to mainframes while Unix is mostly used on servers, workstations or PCs
2. Bash is a shell (command line environment) program of Unix system and Linux system; shell is a process of bash
3. Common commands of linux
- pwd
- cd
- ls
- tail
- cp
- mv
- rm
- mkdir
- is rm
- sudo
- diff
- chmod
- kill
- ping: Check the connection status and response time with the server
- top : will display a list of running processes and the amount of CPU each process is using
- df: The df command gets a report on the disk space usage of the system in percent and KB
- du: Check how much space a file or directory takes
- head: head -n 5 filename.ext is similar to tail, but only gets the first 5 lines
4. Linux log processing command
- cat filename#display all file contents
- more filename#Display file content in pages
- less file name#Similar to more, it is better to turn the page forward
- tail file name #Only view the tail, you can also specify the number of lines
- head file name #Only view the header, you can also specify the number of lines
5. Commands to view logs in real time
- tail -f /logs/appname/20220228.log = tailf /logs/appname/20220228.log
- tail -n 200 -f /logs/appname/20220228.log The last two hundred lines of the latest log
- multitail /logs/appname/a.log /logs/appname/b.log displays the contents of two logs at the same time: multitail program
- lnav /logs/appname/a.log /logs/appname/b.log displays the contents of two logs at the same time: lnav program