2) The Linux Filesystem and commands#
The Linux Filesystems
Introduction to some Linux bash commands
1. The Linux Filesystem#
The Linux file system can intended in two ways: the directories tree that describes the file organization/structure and the format that defines how files are stored on disk (FAT32, ext4, etc). In this class, we will talk about the default layout of the directories tree on a Linux system.
Tip
Check this very useful resource on The Linux Filesystem
Directory |
Description |
---|---|
|
Root directory of the entire file system |
|
Essential command binaries needed for single-user mode |
|
Boot loader files (e.g., kernels) |
|
Device files (e.g., keyboard, mouse, etc; convenient to back up) |
|
Specific system-wide configuration files |
|
Users’ home directories, containing saved files, personal settings, etc. |
|
Libraries essential for binaries in /bin and /sbin |
|
Mount points for removable media (e.g., CD-ROMs) |
|
Temporarily mounted file systems |
|
Add-on application software packages (e.g., Word Procs, Accounting soft, etc.) |
|
Home directory for the root user |
|
Information about the running system since last boot |
|
Essential system binaries (e.g., fsck equivalent to Windows CHKDSK) |
|
Site-specific data served by the system (e.g., Web servers data and scripts, etc.) |
|
Information about devices, drivers, some kernel features |
|
Temporary files (usually not preserved between system reboots) |
|
Secondary hierarchy for read-only user data (e.g., multi-user utilities and applications) |
|
Files whose context is expected to continually change during normal operation of the system (e.g., logs, spool files, etc.) |
2. Some basic Linux commands#
Tip
Check this very useful resource on Linux command line for beginners
Command |
Meaning |
---|---|
|
Clean screen (keeps command history) |
|
Initialize terminal |
|
Move cursor to the beginning of command line |
|
Move cursor to the end of command line |
|
List current working directory content |
|
List permission strings and other info |
|
Sort files and directories by their last modification time (most recently modified first) |
|
List all files with txt extension |
|
List all files (including hidden files) |
|
List files in root directory |
|
Print current working directory |
|
Change working directory to root |
|
Change working directory one level up |
|
Get back to previous directory |
|
Short hand for your home directory |
|
Create new directory dir under current directory |
|
(no spaces) Create new directories |
|
Create a parent directory |
|
Remove files |
|
Remove directory dir and its content recursively |
|
Move or rename existing files/directories |
|
Concatenate files |
|
Create empty files or edit existing file |
|
Execute a local command/program/script |
|
Change file permissions |
|
See documentation of any |
Exercise 2.1
Print the current working directory
Tip
If you want to use any shell commands in your Julia Jupyter notebook, you can simply change the mode of the Julia REPL by prepending ;
to your command.
Exercise 2.2
Create a new directory and move into it
Exercise 2.3
Now that you have created a directory, initialize a
git
repository (Exercise 1.1. from last class)
Exercise 2.4
Delete the newly created directory