Linux

 Linux Folder Structure


/bin    (binaries)  --> essential commands are here ls,cat, grep etc

/sbin    (system binaries)   --> admin commands, reboot, iptables etc.

/boot             --> (contains linux kernal )when linux server is started, it refers to the boot directory.

/etc     (extra configuration) --> system configuration files eg: nginx, ssh configurations etc.

/dev     (device)     --> monitor, terminal, keyboard, mouse, printer

/home    (home directory of users) --> all user directories are here, all user personal files and configurations files are here

/lib    (libraries)     --> libraries required by OS. it  is equal to .dll in windows

/lib64    (64 bit libraries)

/media    (media devices)

/mnt    (mount)     --> adding extra discs

/opt    (optional)     --> if we want any third aprty custom applications. we keep here.

/proc    (processer)     --> processer related information --> proc/cpuinfo, proc/meminfo

/root    (Root user)     --> home directory of root user.

/run    (Running information of server)

/srv    (service files)    --> when you use your server to serve as file server you can use this.

/swap    (swap space)    --> if there is 1 Gb of RAM, if it is fully utilized, then OS will use this swap                                                     space  as  extension of RAM.  As reserved space.

/sys     --> system kernal info, device info

/tmp    (temporary directory)

/usr     ()     -->shared files and documents between users

/var    (variable) --> frequently variable like logs, and messages




=================================================================

touch upstream-log.txt    --> creates the file.

stat upstream_log.txt     --> it shows all the timestamps of the file

ls -l - h (or) ls -lh     --> 'l' for list details 'h' for human readable


cat error.log | sort | uniq     --> sort to sort the line by line, 'unique' to remove duplicates

tac <filename>        --> to view the file content in reverse order.

chmod 

chown billybod file.txt    --> changing the owner of the file.


ps -ef    --> list of processes


Deamon     -- > scripts which run in the background for long time.

./myscript.sh &--> here '&' means run the script in the background


crontab -e

20 4 * * * /relax.sh    --> to schedule a job

kill <processid>    --> to kill the process

kill -9 <processid>    --> to forcefully kill the process


tar -czvf archive.tar.gz ./movies

    

To reload the configurations of a running service without restarting it 

systemctl reload <service name>    --> to rename only specific service

systemctl demon reload     --> to reload all the services




Q&A

Where is the directory.service file available    --> /etc/systemd/system

Where are the repos directory    --> /etc/yum.repos.d





Comments

Popular posts from this blog

Ansible