Linux Commands
Linux Commands
ls
ls -l
cd /home/user
cd ..
pwd
mkdir <new_folder_name>
mkdir -p /path/to/multiple/directories
touch
cp – Copy command
cp <source_file> <destination_file>
cp -r /path/to/source/ /path/to/destination/
mv <oldfile_name> <newfile_name>
It moves the content from one file to another file
mv <file.txt> </path/to/new/location/>
rm – Remove command
rm –f <file_name>
rm -rf <directory_name>
force remove the files & folders of directory recursively (-f force).
rmdir <empty_folder>
cat <file_name>
tac <file_name>
less <file_name>
head <file_name>
head -n 5 <file_name>
tail <file_name>
tail -n 5 <file_name>
-n specifies the number of lines to display.
755 grants read, write, execute for the owner, and read/execute for group and others.
df -h
du -sh /path/to/directory/
5. Process Management
ps
ps -ef
kill <pid>
kill -9 <pid>
-9 forces termination.
6. Networking Commands
ifconfig
ping <hostname>
Test network connection. It tests the reachability & responsiveness of the remote host.
netstat -lntp
ssh user@<remote_host_address>
wget <url>
curl <url>
7. System Information
uname
hostid
uptime
Shows the elapsed time duration since the machine logged in.
whoami
last
date
history
8. Package Management
To restart a service