Skip to main content

Linux Commands

  1. List Files & Directories
ls 
ls -l
ls -A
ls -A -l
  1. Create Files
touch file.txt 
  1. Copy Files
cp file.txt new-file.txt 
  1. Rename Files
mv file.txt FILE.txt 
  1. Create Directories
mkdir demo 
  1. Copy Directory
cp -r dir1 dir2 
  1. Move files from one directory to another
mv file dir 
  1. Remove Directory
rm -rf demo 
  1. List Content
cat file  
  1. View top and end lines
head file 
head -n 3 file
tail file
tail -n 3 file
  1. Search for a word and print the lines
grep word file-name 
  1. Filter with colum
awk -F , '{print $1}' file.csv 
  1. Editor (vim)

  2. Find the files

find / -name "passwd"
  1. Browse and Download
curl -L google.com 
curl -o file.zip http://domain.com/file.zip
curl -O http://domain.com/file.zip
  1. Extract files
tar -xf sample.tar.gz 
unzip file.zip
  1. Check process running
ps -ef 
ps -ef | grep nginx
  1. User Management
useradd demo 
  1. Package Management
yum install nginx -y 
yum list all | grep nginx
  1. Service Management
systemctl start nginx 
systemctl enable nginx
systemclt restart nginx
  1. Permissiong Management
chmod u+x file.txt 
chown demo:demo file.txt
chown demo:demo dir1 -R