Table of contents
Today I have practiced Linux Basic commands as follows:
- locate
- find
- chmod
- chown
- grep
- history
- alias
- sort
- jobs
- ping
- wget
- top
- uname
- zip
- unzip
- hostname
- useradd
- userdel
- lscpu
- free
- umstat
- id
- getent
- lsof
- nslookup
- netstat
- sed
- cut
- htop
Description:
- To locate a file and return the directory it present in
locate
- In case to display all files and the directory it present in
locate "*.txt"
- To display all files in the directory
find .
- display in the previous direc
find ..
- display only direc
find . -type d
- display only files
find . -type f
- display files with a specific name
find . -type f -name "two"
- display files modifies specific time ago
find . -type f -mmin-20
- display files that are empty
find . -empty
- display files with read,write,execute
find . -perm 777
- find all text files and remove
find . -type f -name "*.txt" -exec rm -rf {} +
- To control/modify file permissions
chmod u=rwx,g=rw,o=r file.txt
- modifying with numbers, 4 for read, 2 for write, 1 for execute
chmod 777 file.txt
- To change file owner
chown root file.txt
- To search for a string in group of files
grep "kunal" names.txt
- search complete word
grep -w "kunal kush" names.txt
- search and display line number
grep -n "name" names.txt
- complete word which is case sensitive, line number in all files
grep -win "name" ./*.txt
- To know the history of commands used
histroy
- To replace one string with another
alias
- To sort in a file
sort
- To show running processes
jobs
- To connect to server and receive packet
ping
- To download
wget
- To show running softwares
top
- To display kernel name
uname
- To create compressed file
zip
- To unzip file
unzip
- To obtain hostname and DNS info
hostname
- To add user
useradd
- To delete user
userdel
- To show cpu details
lscpu
- To show free memory check
free
- To show virtual memory check
umstat
- To see groups
id
- To see user exit
getent
- To list all open files
lsoff
- To check IP of a domain
nsloopup
- To see active ports
netstat
- stream editor logs
sed
- To cut out selected portions of each file of a line
cut
- To show resource consumptions
htop
Conclusion: I have completed training on basic Linux commands on day 3 of learning devops course by kunal.
Source: Kunal YT