Skip to content

Instantly share code, notes, and snippets.

@ikennarichard
Forked from Ksound22/terminal-commands.md
Created November 28, 2022 19:07
Show Gist options
  • Save ikennarichard/5f54a855356ca6144b0907b7c8bc2e9a to your computer and use it in GitHub Desktop.
Save ikennarichard/5f54a855356ca6144b0907b7c8bc2e9a to your computer and use it in GitHub Desktop.

Terminal Commands for Beginners

This is a list of terminal [or command line] commands every beginner should familiarize themselves with. This gist file is a manual for this video:

Keys and Key Combos you can Use in the Terminal

  • Up Arrow — Shows the previous command executed. If you continue to press it, it gives you more and more commands you executed. YOu can also press the down arrow to see the previous command after pressing Up arrow.
  • Home button — Takes the cursor to the start of the command line
  • End button — Takes the cursor to the end of the command line
  • CTRL + F — Takes the cursor one character forward
  • CTRL + B — Takes the cursor one character backward
  • ALT + F — Takes the cursor one word forward
  • ALT + B — Takes the cursor one word backward
  • CTRL + A — Takes the cursor to the start of the command line
  • CTRL + L — Clears the terminal
  • CTRL + XX — Switch the cursor position between the current and last position
  • CTRL + C — Bursts the currently executing command
  • CTRL + D — Closes the terminal

Basic Commands

  • whoami — Prints the user information.
  • clear — Clears the command line. In the standard windows command line, you have to enter cls to do the same thing.
  • sudo ... — The command you have to attach prepend to any command that requires administrative permisions.
  • echo <string> — The echo command outputs a string to the terminal
  • man — Stands for "manual". It displays the user manual of any command
  • command --help — Shows the help menu of a command

Flags

A flag modifies what a command does. As I proceed, I'll talk about the flags of a particular command.

Commands for Working with Folders

  • pwd — Shows the current working directory.
  • cd <path> — Stands for "change directory". It channges the present working directory to the specified directory.
  • ls — List the content (files and folders) of the present working directory. In the windows command line, you have to enter dir to do the same thing.
  • mkdir — Stands for "make directory". It creates a new folder.
  • rmdir — Stands for "remove directory". It deletes a folder.

Commands for Working with Files

  • touch <filename> — Creates a new file
  • mv <old name> <new name> — Renames a file or folder. You can also use it to move a file to a particular folder.
  • rm — Deletes a file
  • cp <old name> <new name> — Copies and pastes a file. The old name is the name of the file and the new name is the name you want to assign to the pasted copy of the file.
  • head <filename> — Prints the first 10 lines of a file. YOu can use the -n flag with it to print more than 10 lines.
  • tail <filename> Prints the last 10 lines of a file. YOu can also use the -n flag with it.
  • cat <filename> — Prints all the content of a file. You can also use it to add more content to a file.
  • wc — Stands for word count. It shows the number of lines, number of words, and the byte size in a file.
  • find — Prints the file tree of the CWD
  • find -name <filename> or <foldername> — Searches and locates a file or folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment