Linux File System
The / in the instruction above refers to the root directory. The root directory is the one from which all other directories branch off. When you run tree and tell it to start with /, you will see the whole directory tree, all directories, and all the sub-directories in the whole system, with all their files.
Run this command to check the level of the filesystem
sudo apt install tree
tree -L 1 /
Linux File System
/bin
/bin is the directory that contains binaries, that is, some of the applications and programs you can run
/boot
The /boot directory contains files required for starting your system
/dev
/dev contains device files. Many of these are generated at boot time or even on the fly. For example, if you plug in a new webcam or a USB pendrive into your machine, a new device entry will automatically pop up here.
/etc
etc gets its name from the earliest Unixes and it was literally “et cetera” because it was the dumping ground for system files administrators were not sure where else to put
/home
/home is where you will find your users’ personal directories
/lib
/lib is where libraries live. Libraries are files containing code that your applications can use.
/media
The /media directory is where external storage will be automatically mounted when you plug it in and try to access
/mnt
The /mnt directory, however, is a bit of remnant from days gone by. This is where you would manually mount storage devices or partitions. It is not used very often nowadays.
/opt
The /opt directory is often where software you compile (that is, you build yourself from source code and do not install from your distribution repositories) sometimes lands. Applications will end up in the /opt/bin directory and libraries in the /opt/lib directory.
/proc
/proc, like /dev is a virtual directory. It contains information about your computer, such as information about your CPU and the kernel your Linux system is running
/root
/root is the home directory of the superuser (also known as the “Administrator”) of the system
/sbin
/sbin is similar to /bin, but it contains applications that only the superuser (hence the initial s) will need
/usr
The /usr directory was where users’ home directories were originally kept back in the early days of UNIX
/srv
The /srv directory contains data for servers. If you are running a web server from your Linux box, your HTML files for your sites would go into /srv/http (or /srv/www). If you were running an FTP server, your files would go into /srv/ftp.
/var
/var contains things like logs in the /var/log subdirectories. Logs are files that register events that happen on the system
User Administration
1.Add a new user – sudo adduser cloudageskill
2.Add the user to a group – sudo usermod -aG sudo cloudageskill
The -aG option tells usermod to add the user to the listed groups.
3.Switch to new user – su -l cloudageskill
4.Delete the user – sudo deluser cloudageskill
Search and Replace Using sed
The general form of searching and replacing text using sed takes the following form:
sed -i ‘s/SEARCH/REPLACEMENT/g’ INPUTFILE
●-i – By default, sed writes its output to the standard output.
●s – The substitute command, probably the most used command in sed.
●SEARCH – Normal string or a regular expression to search for.
●REPLACEMENT – The replacement string.
●g – Global replacement flag. By default, sed reads the file line by line and changes only the first occurrence of the SEARCH on a line. When the replacement flag is provided, all occurrences are replaced. ●INPUTFILE – The name of the file on which you want to run the command.
sed -i ‘s/CloudSkill/CloudageSkill/g’ file.txt