Last active
June 2, 2022 09:54
Revisions
-
afro-coder revised this gist
Jun 2, 2022 . 1 changed file with 69 additions and 25 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,12 @@ # Linux System Admin Primer ### Challenge https://github.com/livialima/linuxupskillchallenge ### Linux Guide https://tldp.org/LDP/intro-linux/html/index.html ### Basic Commands ◦ ps ◦ df ◦ du @@ -14,58 +17,99 @@ https://github.com/livialima/linuxupskillchallenge ◦ zless ◦ grep ### Check if SSH is enabled ``` systemctl status sshd ``` ### Check for a Port that is listening on the server ``` ss -patun | grep 2222 ``` ## Firewall management Install a package ``` yum install -y firewalld ``` List Firewall ports ``` firewall-cmd --list-all ``` Add predefined services ``` firewall-cmd --permanent --add-service=httpd ``` List predefined services ``` firewall-cmd --get-services ``` Add a service to the firewall ``` firewall-cmd --permanent --add-service=http firewall-cmd --reload ``` Open a port in linux, replace tcp with udp for UDP ports ``` firewall-cmd --add-port=portnumber/tcp --permanent firewall-cmd --reload ``` ### Selinux (Advanced) Turn it off for now ``` setenforce 0 ``` Read about SELinux first https://wiki.gentoo.org/wiki/SELinux/Tutorials https://wiki.gentoo.org/wiki/Category:SELinux https://wiki.gentoo.org/wiki/SELinux/Tutorials/How_SELinux_controls_file_and_directory_accesses ### Package Management Install a package or multiple ``` yum install -y vim tmux ``` #### To view files owned by package ``` repoquery -l httpd ``` #### Get installed packages with the name httpd ``` yum list installed | grep httpd ``` ### Process Management #### Grep Httpd pid ``` pgrep httpd ``` #### Grep process list ``` ps aux | grep httpd ``` #### Filter per process ``` ps -ylC httpd ``` #### File Processing • vim → press i to go to insert mode, vimtutor will help you learn basic vim • wc → Word Count for lines → wc -l #https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/text-information-tools.html • shell redirection, >, >>, 2>1 # https://tldp.org/LDP/abs/html/io-redirection.html Basic file commands https://tldp.org/LDP/abs/html/basic.html • less => View files in a pager mode -> Ability to view and search text • cat → Spit all the lines to the terminal • zless → compressed files • zgrep → grep through compressed files • grep → grep through files -
afro-coder renamed this gist
Jun 2, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
afro-coder revised this gist
May 31, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,9 @@ firewall-cmd --permanent --add-service=httpd ### List predefined services firewall-cmd --get-services #### open a port in linux, replace tcp with udp for UDP ports firewall-cmd --add-port=portnumber/tcp --permanent firewall-cmd --reload # Selinux (Advanced) Turn it off for now -
afro-coder created this gist
May 30, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ Linux Guide https://github.com/livialima/linuxupskillchallenge # Basic Commands ◦ ps ◦ df ◦ du ◦ vim ◦ top ◦ less ◦ more ◦ zless ◦ grep # Check if SSH is enabled systemctl status sshd # Check for a Port that is listening on the server ss -patun | grep 2222 ## Firewall management ### Install a package yum install -y firewalld ### List Firewall ports firewall-cmd --list-all ### Add predefined services firewall-cmd --permanent --add-service=httpd ### List predefined services firewall-cmd --get-services # Selinux (Advanced) Turn it off for now setenforce 0 ## Package Management ### Install a package or multiple yum install -y vim tmux ### To view files owned by package repoquery -l httpd ### Get installed packages yum list installed | grep httpd ## Process Management ### Grep Httpd pid pgrep httpd ### Grep process list ps aux | grep httpd ### Filter per process ps -ylC httpd ## File Processing • vim → press i to go to insert mode, vimtutor will help you learn basic vim • wc → Word Count for lines → wc -l • shell redirection, >, >>, 2>1, • less => View files in a pager mode -> Ability to view and search text • cat → Spit all the lines to the terminal • zless → compressed files • zgrep → grep through compressed files