DEV Community

Cover image for Linux Terminal Cheat Sheet (Useful for Beginners)
Clean Code Studio
Clean Code Studio

Posted on • Updated on

Linux Terminal Cheat Sheet (Useful for Beginners)

Twitter Follow

A Linux cheat sheet for beginners (short, sweet, and to the point)


Linux (Useful Commands) Terminal Cheat Sheet


Navigation Commands:

  • passwd - change password
  • ls - list directory (Can point at any point on the machine)
    • -la a flag that lists all + permissions and hidden files
  • pwd - print working directory - check where you're at
  • cd - change directory (Can address at any point in the machine file system)
  • mkdir - make directory
  • rmdir - remove director
  • rm - remove files
  • echo - sends data (if no destination is given than data is sent as output to the terminal)
  • cp copy a file (cp [source] [desintation])
  • mv - mv a file (mv [source] [desintation])
  • locate - locate a file on the machine (locate [filename])
  • updatedb - updates the directory database (must run before running locate)
  • man - manual page of any command
  • grep - search for the following words (can be used to check if a file contains specific info)

Linux is case sensitive so be aware of your capital letters!

  • ./ - your directory right now
  • ../ - previous folder
  • ~ - the users root folder
  • | - pipe the output of one command into another
  • > - use command on the following file (overwrite)
  • >> - use command on following file (appends)

Privilege's and user commands:

  • cat - reads a file to the terminal
  • chmod - changes permissions for a file
  • adduser - make a new user
  • sudo - give root permissions for the following command being executed
  • su - switch user

Network Commands:

  • ifconfig - print network information
  • iwconfig - wireless network information
  • ping - ping an ip address (-c flag lets you define how many times you wish to ping the given ip address)
  • arp -a - send out an arp request to check for machines on the network
  • netstat -a - shows all open ports and what is connected to these ports
  • route - shows a routing table

Viewing, creating, and editing commands:

  • history - lists the 15 commands you entered (history | grep [command] shows all the times you run a command on the machine (including specific syntax))
  • touch - create a file
  • nano - use the nano text editor
  • apt-get - install [program name] - install a program on the machine (can be run without the install)
  • apt install - install a file from the system / kali - server
  • apt purge - program name - (You have to use the * *)
  • pip install - run an installer for local files
  • git clone - clone a github repository (This is a plugin and does not come preinstalled on most linux distributions!)

Webserver Commands:

  • service apache2 start - start a webserver
  • service ssh start - start an ssh server
  • service postgresql start - a service that starts with metasploit
  • service apache2 stop - stops the webserver
  • systemctl enable [program name] - start the service when the machine turns on

Important files/directories in Linux:

  • /etc/passwd - a file that stores all of the users in the system
  • /etc/shadow - stores all of the passwords in the system
  • /var/log/auth.log - authentication reports

Thanks for reading and feel free to follow Clean Code Studio for more!


The End


Clean Code
Java Script Design Patterns
JavaScript Algorithm Examples


Clean Code Studio
☕️ Code Tips
☕️ Career Advice
☕️ Developer Memes
Shiny button, Fancy 𝗡𝗲𝘄𝘀𝗹𝗲𝘁𝘁𝗲𝗿 👇, Juicy Dev Tips...wanna join?

Yes, I want in! Button to go sign up for clean code studio newsletter

(Discover [50+ pages] of my personal FAANG interview notes!)


Follow @cleancodestudio on Twitter
Follow @cleancodestudio on YouTube
Follow @cleancodestudio on TikTok
Follow @cleancodestudio on Facebook
Follow @cleancodestudio on Instagram
Follow @cleancodestudio on LinkedIn
Follow @cleancodestudio on Reddit
Follow @cleancodestudio on Dev.to
Follow @cleancodestudio on Stack Overflow
Follow @cleancodestudio packages on npm
Follow @cleancodestudio packages on packagist
Star @cleancodestudio on Github

Top comments (2)

Collapse
 
aniganesh profile image
Aniganesh • Edited

Is there like a downloadable version of this? Perhaps an image or pdf?

Collapse
 
cleancodestudio profile image
Clean Code Studio