File Management :
- ls – To list files
- ls -l > Display long list files
- ls -la > Shows long list files including hidden files
- ls -ltr > Long list files and sort by modification time. oldest placed first.
- less – for viewing files
- Wants to view longer files you can use less command.
- It will pause after displaying screen of context
- press q to return to the shell
- cat – Display the content of file
- Cat command used to read the file or it displays all contents of file on screen
- head -Displays top 5 lines of file
- head -n 10 filename > Displays first 10 line of file
- tail – Display last 10 lines of file
- tail -f /var/log/maillog > to monitor the incoming log in runtime
- more – it is similar to less command But for scroll down you must use SPACE
- unique – Displays a file skips duplicate lines. It does not change original file
- file – Identifies the content of file
- cp – (copy) this makes a copy of file
- cp source-file destination (eg. cp /root/file1 /var/dir/) This command copied content from file to /var/dir directory
- if the destination file exists cp command will overites it.
- mv – rename and for move the file
- mv existing-file-name new-file-name > to rename the file
- mv /var/file1 /etc/dir > this command move file1 to /etc/dir directory
- grep – to search in file contents
- The grep utility searches through one or more files to see whether any contain a specified string of characters.
- This utility does not change the file it searches but simply displays each line that contains the string.
- eg : grep error /var/log/maillog > it will search error word in file maillog
- mkdir – This command creates directory
- touch – this command to create empty file
- pwd – Shows the working directory path.
Find Directories and files:
- which – Shows full path of command eg . which cat > /usr/bin/cat
- whereis – Shows the path of program
eg. whereis sshd > sshd: /usr/sbin/sshd /usr/share/man/man8/sshd.8.gz
- find – it will search for file or directory it depends on option given by user
eg. find / -type f -name hhtpd > displays file named httpd under / directory
Check System information:
- uptime – It shows running status of machine in single file
- Time the machine has been running
- number of users logged in
- the load average (it will be past 1, 5 , 15 minutes)
- free – (free -m) Displays the amount of RAM(Physical) and the swap memory . it display columns for used and free memory
- lshw – This is small tool to display detailed information of hardware configuration of the machine
- hwinfo – It can be used to view log which are used for support
- lscpu – Display CPU information path is (/proc/cpuinfo)
- lspci – Displays information about PCI buses
- uname – Displays system information
Check User Information:
- users – Shows currently logged in users into the current host
- who – This will displays users who logged in the local system
- finger – Displays entry of each user currently logged into system
- last – (last -a) Displays list of users logged in and out
- whoami – Displays username of current user id
- id – displays user and group IDs
- w – Displays the same as Uptime command
Manage system Processess
- top – This command displays real time view of running system . Shows threads managed by the linux kernel
- ps – Displays information of active processes
- nice – this effects on process scheduling
- kill – This command kills the specific process
- vmstat – Shows the information about processes, memory, paging, block io , traps, disks, and cpu activity
- iostat – this command is used for monitoring system input output device loading
- crond – this service used to execute scheduled commands
using crontab -e set the time to execute the command

