The Unix shell, is also known as the Terminal or the Command Line Interface. It uses a language called Bash that executes commands from a text-based interface, or shell.
These commands work in all Unix-based systems (Linux and MacOs for example). Use them to communicate directly with your system. Learning to work with your terminal is a great skill to have in many aspects of computing. But while the terminal can be intimidating, it is also a fundamental skill that anyone working with computers should have. See the examples below to get started with some basic commands, as well as other more powerful commands.
Note: be careful when working in the Terminal, however. You can erase files or change things in ways you may not intend if you aren't careful.
Flags
Some Bash Commands also use flags, or additional arguments to add functionality. For example:
$ ls -a
Uses the -a flag to print out all the files, including the hidden ones. YES! there are hidden files and you didn't even know!
Documentation
You can find documentation or a "manual" for each of the commands by using the man command:
$ man cp
This will give you a list of all the options for the copy command.
Commands
$ cd
change directory ($ cd team_edge or cd .. to navigate out of the directory)
$ ls
list files in current directory ( $ ls -a lists all files, including hidden files)
$ mkdir
to create a new directory inside the current one
$ touch
creates a new file
$ pwd
prints current directory, helpful to find where you are at
$ cp
Copy files from one location to another
$ mv
This moves a file from one location, but does not copy the file. You can also use this to rename a file by not specifying a destination directory.
$ rm
To remove a file (Be careful! For directories adding the -r flag will recursively delete all the subfolders as well)
Example usage
$ cd ~/Desktop
$ cd ..
$ ls
$ ls -a
$ mkdir new-folder
$ mkdir folder1 folder2
$ touch new_file.py
$ cp file_to_copy /home/pi/destination
$ mv file1.py /path/to/destination
$ mv old.py /same/path/to/file/new.py
$ rm /home/pi/folder_to_remove
$ rm ~/Desktop/pictures/selfies -r
$ curl
Use it to fetch URL data, such as files, images, full websites. Output can be saved.
$ curl https://www.google.com > site.html
$ wget
Similar to curl, but wget automatically downloads the data to a specific directory.
$ grep
Used to search files and contents of files. Used with piping | to filter out data from other files.
$ echo
Print out statements to the terminal.
$ cat
Use it to print out contents of a file. Used with | to pass contents to other commands.
$ free -h
Print the available system memory of your Pi in human-readable text
$ cat /proc/cpuinfo
Get CPU info
$ vcgencmd measure_temp
Geta quick print-out of the chip temperature.
$ lsusb
Get info on connected USB devices (add --verbose flag for tons of details)
$ sudo reboot
Reboots your Pi
$ raspi-config
This command is one of the most used. Change system settings from networking, to passwords and access to services.
$ sudo apt-get update
Run this command before installing new software. It automatically updates your packages.
$ ifconfig
Prints network information, including IP address
$ hostname -I
Prints just the IP address for the pi
$ cat /proc/version
Print the Raspberry Pi version you have
$ pinout
Prints out an image of all the GPIO pins on the Pi, including active connections.
$ sudo shutdown -h now
Shuts down the Pi (do this when connecting components to GPIO pins, for example)
Learn more :
https://www.raspberrypi.org/documentation/linux/usage/commands.md