Some useful linux terminal commands

Here are some Linux terminal commands that I find useful for me.

Working with text files
  • create file
touch file.txt
  • create and open a file with nano
nano file.txt
  • Read the content of a file (3 different approaches)
cat file.txt
more largefile.txt
less largefile.txt
  • read the first 5 lines of a file
head -n 5 file.txt
  • read the last 5 lines of a file
tail -n 5 file.txt
System and Process Management
  • display running processes
ps aux
  • display dynamic real-time view of running processes
top
  • check disk space usage
df -h
  • check file and directory sizes
du -sh *
Searching and Text Manipulation
  • search for text in files
grep "search_text" file.txt
  • search recursively in directories
grep -r "text" /path/
  • find files and directories
find /path -name "filename"
  • count lines, words, and characters
wc file.txt
  • compare two files
diff file1.txt file2.txt
File Permissions and Networking
  • change file permissions
chmod 755 script.sh
  • change file owner
chown user:group file.txt
  • check network connectivity
ping google.com
  • display network connections
netstat -tulnp
  • download files from the web
wget https://example.com/file.zip

Author

Rami Boutassghount

Rami Boutassghount

🌐 Change language