author-pic

Paulo Bomfim

First commands for the Linux Terminal


Published on March 08, 2020

In this post I will write the main commands of the linux terminal for you to learn in a simple way.

The main objective here is to enable you to take the first steps in the Unix environment, ok?

Let's Go !


Getting started



To start we'll open the terminal. You have two ways to do this :

  • Search for Terminal
  • Press CTRL + ALT + T

Gatsby

That done, let's go to the main commands used for navigation in the terminal!


Commands



  1. ls (lists the contents of the current directory)
$ ls 

  1. ls -a (lists all content, including hidden files and executable files)
$ ls -a

  1. ls -l (lists all detailed content)
$ ls -l

  1. pwd (informs the current directory)
$ pwd

  1. cd (change to directory)
$ cd Downloads

  1. cd - (go back to the previous directory)
$ cd -

  1. cd .. (go back to the directory above)
$ cd ..

  1. mkdir [name to new folder] (create a folder)
$ mkdir my_new_folder

  1. mkdir [name to folder 1] [name to folder 2] (creates two folders at the same time)
$ mkdir folder1 folder2

  1. mkdir -p [name to folder]/[name to sub-folder] (create a directory and sub-directory)
$ mkdir -p Photos/Sweet_pictures



Extra commands



  1. mv [old_name] [new_name] (rename a directory or file)
$ mv Photos_folder Pictures
$ mv code_01.txt code.c

  1. mv [old_directory] [new_directory] (change a folder/file directory)
$ mv main.c codes/main.c
$ mv Downloads/Vacation_Photos Images/Vacation_Photos

  1. cp [file/folder] [new_directory] (copy a folder/file to other directory)
$ cp main.c Codes/

  1. clear or CTRL + C (clear the window)
$ clear

  1. cat > [file_name] (create and write in new file)
$ cat > test.txt

  1. touch [file_name] (create a file)
$ touch test

  1. locate [file_name] (locate a file)
$ locate image.jpg

Some shortcuts in the terminal



  1. CTRL C (ENDS a command/process)
  2. CTRL Z (STOPS a command/process)
  3. CTRL A (back to beginning of the command line)
  4. CTRL U (erase the typed line)

From these tips you are ready to start your Linux journey!

Don't give up and continue!

Until nex time, bye !



If you like it, share it!