DEV Community

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

Posted on • Edited 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](https://cleancode.studio/clean-code) [Java Script Design Patterns](https://cleancode.studio/design-patterns) [JavaScript Algorithm Examples](https://cleancode.studio/algorithms) --- [Clean Code Studio](https://cleancode.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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7hwc3k4pzedr59fnr9r.png)](https://cleancodestudio.paperform.co/) (Discover [50+ pages] of my personal FAANG interview notes!) --- [Follow @cleancodestudio on Twitter](https://twitter.com/cleancodestudio) [Follow @cleancodestudio on YouTube](https://youtube.com/c/cleancodestudio) [Follow @cleancodestudio on TikTok](https://tiktok.com/@cleancodestudio) [Follow @cleancodestudio on Facebook](https://facebook.com/cleancodestudio) [Follow @cleancodestudio on Instagram](https://instagram.com/cleancodestudio) [Follow @cleancodestudio on LinkedIn](https://linkedin.com/company/cleancodestudio) [Follow @cleancodestudio on Reddit](https://reddit.com/r/cleancodestudio) [Follow @cleancodestudio on Dev.to](https://dev.to/cleancodestudio) [Follow @cleancodestudio on Stack Overflow](https://stackoverflow.com/users/8541350/clean-code-studio) [Follow @cleancodestudio packages on npm](https://npmjs.com/~zhorton999) [Follow @cleancodestudio packages on packagist](https://packagist.org/packages/clean-code-studio) [Star @cleancodestudio on Github](https://github.com/zhorton34)

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