Last active
June 28, 2023 01:02
-
-
Save josdem/b911709284b69b1561bc to your computer and use it in GitHub Desktop.
This file contains 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 characters
# Ubuntu | |
//How to see Linux version | |
lsb_release -a | |
cat /etc/centos-release | |
//Add user | |
adduser tomcat | |
//Add user with home directory | |
useradd -m -d $path $user | |
w // See who is connected | |
ps -ft pts/0 //Get PID | |
//How to see my Linux version | |
cat /etc/centos-release | |
cat /etc/redhat-release | |
//Install package from rpm | |
sudo rpm -ivh nginx-release-rhel-7-0.el7.ngx.noarch.rpm | |
##SSH login without password | |
//Generate a pair of authentication keys from clien A. Do not enter a passphrase: | |
ssh-keygen -t rsa | |
//append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time: | |
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' | |
//Change the permissions of .ssh to 700 | |
//Change the permissions of .ssh/authorized_keys to 640 | |
// Change from .java to .groovy in files | |
rename "s/java/groovy/" *.java | |
##Install zsh | |
sudo yum install zsh | |
##Install Oh My Zsh | |
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
##Remove OpenJDK in Centos | |
// See what pagkage is installed | |
rpm -qa | grep jdk | |
//Uninstall | |
sudo yum remove ${PackageName} | |
//Search for a text in all files under each directory, recursively | |
$ grep -r "redeem reward" /home/tom | |
//Find a file with keyword including sub-directories | |
find . -name "*lying*" | |
//Changing java to groovy extensions | |
rename "s/java/groovy/" *.java | |
//Count directories in a path | |
ls | wc -l | |
//Counting files in a directory | |
find . -type f | wc -l | |
1. -type f to include only files. | |
2. wc world count | |
//Set date | |
sudo date --set="16 DEC 2015 13:07:00" | |
//Active connections 80 http listing whos is connecting (ip) | |
netstat -an | grep 80 | |
//Number conections 80 | |
netstat | grep http | wc -l | |
//Monitoring request | |
sudo tcpflow -p -c -i eth0 port 80 | grep -oE '(GET|POST|HEAD) .* HTTP/1.[01]|Host: .*' | |
//Ubuntu distribution | |
lsb_release -a | |
//Force install in Ubuntu | |
sudo apt-get install -f | |
//The size of all the directories,files etc in current directory in human readable format | |
du -sh * | |
//How to escape spaces in path during scp copy in linux | |
sudo scp -r josdem@192.168.2.4:Ubuntu\\\ One/Music/Ambient . | |
//Verifying Which Ports Are Listening | |
netstat -tanp | grep LISTEN | |
//Displays the last part of a file | |
tail -f -n 100 /var/log/syslog | |
# Centos | |
//Version | |
cat /etc/centos-release | |
//Memory Information | |
cat /proc/meminfo | |
//CPU Information | |
lscpu | |
//HD Information | |
df -H | |
//List all rpm packages by keyword | |
yum search all java | |
# Both | |
//Change hostname | |
hostnamectl set-hostname new-hostname | |
//See graphic card | |
lspci -vnn | grep VGA | |
//See process running | |
ps -o pid,user,%mem,command ax | sort -b -k3 -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment