-
Notifications
You must be signed in to change notification settings - Fork 0
Step 6: Linux administration
monotiller edited this page May 27, 2022
·
2 revisions
-
mkdir
# Makes a directory -
ls
# Lists contents of a directory -
tree
# Shows a tree of directories -
sudo
# Fixes everything, all my problems have been solved this way -
rm
-rf # Removes a folder -r = recursively and -f = force -
df
# Disk Free, shows information about current disk usage -
free
# Shows stats on RAM and swap memory
-
-h
# Human readable, converts units to be easier to read
Symlinks are super useful to link files to new directories so one file can appear in many places. A few examples I have are my .vimrc configs/plugin which I store in a git repository that is stored elsewhere, another is on my webserver I have a folder for my encryption certificates which allows me to have a folder to automate renewals whilst distributing those out to the folders they need to be in
-
/boot
directory stores data related to booting up the system -
/cdrom
is where attached CDs to the system are accessed from, similar to/media
and/mnt
-
/dev
location of device files. A device file is an interface to a device driver -
/etc
is where configuration files are kept -
/home
where users keep files related to their account (documents, photos, videos) -
/lib
Libraries are a collection of resources used by the computer, also considered modules -
/lost+found
found in each partition, used for things like system recover -
/opt
custom applications that are not essential to the operating system -
/proc
process folder. An instance of an application -
/root
the home folder for the root user -
/run
mountpoint fortempfs
filesystem in the computer's memory. Temporary data about processes are kept in there. Processes have the extensionpid
-
/bin
this is where binaries are kept -
/sbin
binaries for the system -
/snap
flatpak is better 😏 -
/srv
Where service folders are kept, not so commonly used anymore,/opt
is getting more popular -
/sys
mounted on a virtual file system -
/tmp
where temporary files are kept on disk. Sometimes emptied on OS restart -
/usr
where programs and libraries are stored -
/var
dynamic data and libraries used on the operating system and computer-
/var/spool
for example is a folder related to mail services
-
-
wget
downloads files to local drive -
curl
similar to wget but has more options on how to download objects. Can run basic syntax on them too such as for extracting archives -
vim
text editor, heavily relies on keyboard only navigation -
grep
similar to cat or bat, but lets you filter contents of a file (useful for CSV files, for example). Doesn't support highlighting but when piped with cat it can! -
diff
show the differences between two files -
useradd
adds a new user to the system-
-m
can be used to create a home directory for them too
-
-
passwd
allows you to set a password for a user -
history
shows history of commands entered in to the terminal. I personally use fish and autocomplete because I find it quicker
- Two files that store data about a file
- Inode - Metadata about the file
- File table - file names and inode number
-
ls -i
on an object will return its inode number:
monotiller@laptop ~ ls -i .zshrc
36685457 .zshrc
-
stat
lets you view the inode data
monotiller@laptop ~ stat .zshrc
16777234 36685457 -rw-r--r-- 1 monotiller staff 0 4510 "Apr 7 20:47:35 2022" "Apr 7 16:21:28 2022" "Apr 7 16:21:28 2022" "Feb 25 14:26:49 2022" 4096 16 0 .zshrc
-
find
finds file with names, can also use wildcards -
ps
shows currently running processes
Video repeated from previous lesson
-
chmod
allows you to change the permissions set on a folder or directory - Add
-r
to introduce these changes to child directories and files - Numbers are used to determine the state of permissions:
- Read = 4
- Write = 2
- Execute = 1
- No permissions = 0
- You can use simple addition to combine permissions:
- Read and write = 6
- RWX = 7