Hey there, tech enthusiasts! Ever wondered how to boss around your computer using simple text commands? Well, we've got the scoop for you! In just 6 minutes, we're going to spill the beans on 60 Linux commands that will make you feel like a computer wizard.
Imagine telling your computer what to do, and it actually listens. That's the magic of Linux commands. Whether you're a tech pro or just getting started, these commands will turn you into a command-line superhero.
ssh : used to connect to other systems remotely
ssh user_name@hostName_or_IP
ls : list file contents
ls -l : list with more details
ls -al : list hidden contents
cd : change directory
cd .. : move one directory above
cd / : move to root directory
cd /path : move to any directory
pwd : shows present working directory
touch : create file
touch file.txt : can give any extension
touch file1 file2 file3 : will create multiple files
touch file{1..8} : will create files with characters of that range. (alphabets can also be used)
echo : print any element
echo "hello", echo "stuff stuff" > new_or_existing_file.txt
(this will print the line in a new or existing file)
7. nano : text editor
ctrl x + y + enter to save
vim : another text editor
i :to go to insert mode
esc :to go command mode
wq : to save and quit
cat : see contents of a file
cat file_name
shred : hide contents of a file
shred file_name: unable to view file contents
mkdir : create new folder
cp : copy stuff : cp path path
mv : move stuff : mv path path
rm : remove stuff : rm path path
rmdir : remove empty directory
rm -r : remove directory with contents
ls -s : find size of directory
clear : clean stuff from terminal
whoami : get username of system
sudo : elevate access from regular user, more control
sudo useradd name : add new user
sudo adduser name : set user with more parameters
su user_name : switch user
exit : exit
sudo passwd user_name: set passwd for user
sudo apt update: for debian machines (debian, ubuntu)
sudo yum update: for red hat machines (rhel, fedora)
finger: used to inspect other user (might need to download finger)
finger user_name
man : now more about any command
man cat, man finger
whatis : one line explanation for every command
which : which command : where particular command/file is located
whereis : whereis commands: where all commands are located in the system
wget link : donwload stufffrom internet
curl link > file_name : can rename the downloaded file name when downloading
34. zip name.zip file_name : zips the file
unzip file.zip
less file_name : show less content of a file
head file_name : show topmost stuff of a file
tail file_name : show bottom stuff of a file
cmp file1_name file2_name : chk differences b/w files
diff file1_name file2_name : tells what is the difference
sort : sort stuff alphabetially
find : sudo find / -name "filename" : to find stuff
sudo find . -type f -name ".*" (hidden files)
find . -type f -empty (find empty directories)
find . -perm /a=x (executable files)
chmod +x : make file executable
chown : chown user_name file_name : change ownership of a file
ifconfig : tell ip of system at top
ipaddress : also tells ip at bottom
sudo apt install net-tools : need this for ipaddress
grep: filter things
cat /etc/resolv.conf: chk local dns
resolvectl status : chk online dns
ping : chk web connecntions
traceroute site_link : tells every hop a site has for our connection
netsat: what ports are on linux machine
netstat -tulpn : every switch of linux machine
iptables: firewall management, allow or deny
uname : system name
uname -a : more info
neofetch : same info, prettier (install neofetch)
cal : open calender
echo "4+5" | bc (solve any amth problem)
free : chk free memory available
df : chk disk space
ps : list every process
top : chk process using system stuff
htop : prettier process checking
kill : to kill a process , need process id
ps -aux | grep thisisbash kill -9 pID (-9 is force kill)
pkill : no pID needed ( pkill -f process_name)
services:
sudo systemctl start service_name
sudo systemctl stop service_name
sudo systemctl status service_name
sudo systemctl restart service_name
history: tells every commands used
sudo reboot
sudo shutdown (default takes 1 min)
sudo shutdown -h now