A reminder for me when I forget the command line I've used or the steps of a command I've done. This reminder is also my note when I have solved a problem. I hope this reminder can be useful for those of you who need it.
Table of Contents
run command in background
YOURCOMMAND &
terminate background command
kill %1
permission only root
chmod 755 FOLDERNAMEpermission for all
chmod 777 FOLDERNAME
•
change owner
chown -R USERNAME FOLDERNAMEchange group
chgrp -R USERNAME FOLDERNAME
•
open file manager as root
sudo sugnome-opens .
sudo nautilus
change shell to bash
chsh -s $(which bash)
change shell to zsh
chsh -s $(which zsh)
kernel version
uname -auname -r
•
linux release
lsb_release -a
mounted check
lsblkmount drive
udisksctl mount -b /dev/sda5
•
ntfs read-only files error
sudo ntfsfix /dev/YOURSDALOCATION
search files by name
find /SEARCHLOCATION -type f -iname FILENAME.FILEEXTENSIONsearch files by extension
find /SEARCHLOCATION -type f -name '*.FILEEXTENSION'
search files by last modified
find /SEARCHLOCATION -name '*.*' -mtime -DAYS
print command history
~/.bash_history
or~/.zsh_history
history
delete command history
history -c
search command history
CTRL + R
touch -a -m -t 201512180130.00 FILENAME.FILEEXT
command description a
accessed m
modified t
timestamp [[CC]YY]MMDDhhmm[.ss]
format
for file in *.jpg; do convert $file -quality 50 ../convert/$file; done
alias graph="git log --all --decorate --oneline --graph"
sudo dpkg -i /path/to/deb/filesudo apt-get install -f
start service
systemctl start docker
sudo rm /etc/resolv.confecho 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf
repository size check
git count-objects -vHremote connection test
ssh -T git@github.compush to different branch name
git push origin LOCALBRANCH:REMOTEBRANCHpush all branch
git push origin --alldelete remote branch
git push --delete origin REMOTEBRANCHbreaks the fast-forward rule (git refs error)
git push --force-with-lease
create ssh
ssh-keygenswitch ssh
eval "$(ssh-agent -s)"ls -al ~/.ssh
ssh-add ~/.ssh/id_rsa
connect ssh
ssh USER@HOSTssh -i KEYFILE USER@HOST
wget URL
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=OUTPUT.pdf INPUT.pdf
-dPDFSETTINGS Description /screen
Has a lower quality and smaller size. (72 dpi) /ebook
Has a better quality, but has a slightly larger size (150 dpi) /prepress
Output is of a higher size and quality (300 dpi) /printer
Output is of a printer type quality (300 dpi) /default
Selects the output which is useful for multiple purposes. Can cause large PDFS.
•
merge pdf
qpdf --empty --pages *.pdf -- OUTPUT.pdf
snap connect gimp:removable-media :removable-media
show available format
youtube-dl -F URLdownload by format
youtube-dl -f FORMATID URLfix filename error
youtube-dl <url> -o './%(id)s.%(ext)s'
convert INPUT.png OUTPUT.jpg
optipng -o7 INPUT.png
compress video file size
ffmpeg -i INPUT.mp4 -vcodec libx265 -crf 20 OUTPUT.mp4merge video and audio
ffmpeg -i VIDEO.mp4 -i AUDIO.wav -c:v copy -c:a aac OUTPUT.mp4
compress audio file size
lame --mp3input -b 128 INPUT.mp3 OUTPUT.mp3
curl ifconfig.me
7z x FILENAME.ziptar -xvf FILENAME.tar.gzunrar x FILENAME.rar
php server
php -S localhost:8000
·
see service running
sudo netstat -plnt
·
failed to listen on localhost:8080
ps -ef | grep php
kill -9 RUNTIMEID
sudo /opt/lampp/lampp startsudo /opt/lampp/manager-linux-x64.runmysql in command line
sudo /opt/lampp/lampp startmysqlsudo /opt/lampp/bin/mysql -u root
postgresql in command line
systemctl start postgresqlsudo -u postgres psql -U postgrespostgresql export
pg_dump -U postgres dbname > /PATH/FILENAME.sql
postgresql import
pgsql -U postgres dbname < /PATH/FILENAME.sql
postgresql import csv
psql -d dbname -c "COPY tablename (columnname) FROM stdin WITH DELIMITER AS ','" < /dir/file.csv
sudo npm cache clean -fsudo n stablesudo npm install -g n
make python virtual env
python3 -m venv FOLDERNAMEactivate python virtual env
source FOLDERNAME/bin/activate
dotnet create new project
dotnet new console -n PROJECTNAME
Enable CGI module
sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/Add this configuration inside
<Directory /var/www/>
on/etc/apache2/apache2.conf
<Directory /var/www/> Options +ExecCGI AddHandler cgi-script .cgi </Directory>
Restart Apache2
systemctl restart apache2Compile your cpp file and put to
/var/www/html/
sudo g++ FILENAME.cpp -o /var/www/html/FILENAME.cgi
archlinux-java help
archlinux-java statusarchlinux-java set VERSION
docker
permission denied
solution 1sudo chmod 666 /var/run/docker.socksolution 2 (only run when
newgrp docker
is activate)sudo groupadd dockersudo usermod -aG docker $USER
newgrp docker
·
docker list container
docker ps -adocker remove images
docker rmi IMAGEIDdocker build
Dockerfile
docker build -t REPOSITORYNAME:TAGNAME .
dokcer run container with exposing port
docker run -d -p 8080:80 REPOSITORYNAME:TAGNAMEdocker run and entering container
docker run -it alpine /bin/shdocker entering a running container
docker start CONTAINERdocker exec -it CONTAINER YOURCOMMAND
docker run and attach file then remove container after execution
docker run -p 8080:8080 --rm -v $(pwd):$(pwd) php:latest php -S 0.0.0.0:8080 $(pwd)/index.php
insmod part_gptinsmod chainset root=(hd0,gpt1)
chainloader /EFI/Microsoft/Boot/bootmgfw.efiboot
device list and usb debugging
adb devicesuninstall package
adb shellpm list packages -spm uninstall --user 0 com.YOURPACKAGE.BLA.BLA.BLA
sudo apt-get install -y "linux-headers-$(uname -r)"
sudo apt-get install -y dkmsto setup buttons, add the following code in
.bashrc
or.zshrc
if xsetwacom list | grep -q "HUION"; then xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 1 key Ctrl s xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 2 key e xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 3 key b xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 8 key Shift xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 9 key Ctrl xsetwacom set "HUION Huion Tablet_H640P Pad pad" button 10 key Ctrl z fiNOTE: open/restart terminal to activate the code
search active host
nmap -sP 192.168.0.1/24scanning all active host
nmap -v -A 192.168.1.1/24geo location
nmap -p80 --script ip-geolocation-geoplugin TARGET
./gobuster dir -u URL -w WORDLISTFILE.txt
airmon-ng start wlp4s0airodump-ng wlp4s0monairodump-ng -c CHANNEL --bssid BSSID --write FILENAME wlp4s0monaireplay-ng --deauth 50 -a BSSID wlp4s0monaircrack-ng FILENAME.cap -w WORDLISTFILE.txtairmon-ng stop wlp4s0mon
sudo fdisk -lsudo dislocker -r -V /dev/sdb1 -u -/media/bitlockersudo mount -r -o loop /media/bitlocker/dislocker-file /media/mount