2 types:
- Windows: we don't care much about this
- Unix: Mac, Linux, BSD (same family, kind of unix, some are not fully compliant)
All of them should have a command line or terminal.
It's a way to interact with the OS, using text. You write commands. Most people are used to interact with the operating systems using a GUI. This means, they use windows, the mouse, clicking in different folders and navigating.
- Only way to interact with some programming language tools
- Allows automation of tasks
MAC: Go to launchpad and search Terminal
Linux with Gnome: Press the super key and search Terminal
/ root of the operating system
/bin/ binaries
/etc/ configuration files
/tmp/ temporary files
⬆️ are used by the Operating System
Each user usually has its own folder, when you log in, you get your information. You should develop and code in your user folder.
Linux: /home/<username>/
Mac: /Users/<username>/
Shortcut for both linux and mac: ~
A location identifying a folder or a file, in the folder structure, is called path.
E.g: /home/lara/Downloads/
A folder contains files or folders.
A file contains some content.
Usually you can mount a partition anywhere you want. By partition, we mean a hard drive. By mounting, we mean, making it available in the folder structure in order to save files.
For example:
- I have a new 250 GB SSD (internal or external)
- Plug it in
- By running a command, we can make it available, under the following path:
/mount/Lara-250ssd/
The terminal is always "standing" in a folder.
If you use the terminal, you are going to navigate through different folders.
You can use TAB to auto-complete for you in the terminal.
We separate between folders and directories using a slash /
| Command | Description |
|---|---|
pwd |
your current location, the full path |
ls |
lists files and folders in your current path |
mkdir my_folder_name |
create a folder/directory. Tip: avoid using spaces for filenames |
cd my_folder_name |
change directory |
cd ~ or cd |
take you to the home directory |
cd ~/my_folder_name |
Go to my_folder_name |
cd .. |
Change directory to the parent directory |
cd . |
A single dot means the current directory |
touch index.html |
Create an empty file |
cp index.html lara.html |
Copy existing file with a new name |
mv ./lara.html ./about.html |
Moves and/or renames a given file or folder to a new location |
rm about.html |
Remove a file |
rm -rf ~/my_folder_name |
Remove a directory |
cat index.html |
Show the content of a file |