-
-
Save mort3za/2ee614c79f10139674d603f06a0b68ba to your computer and use it in GitHub Desktop.
# Set permission of all files and folders. 755 and 644. | |
find . -type d -exec chmod 755 {} \; | |
find . -type f -exec chmod 644 {} \; | |
find ./app/cache -type d -exec chmod 777 {} \; | |
find ./app/logs -type d -exec chmod 777 {} \; | |
find ./web/upload -type d -exec chmod 777 {} \; | |
#find /opt/lampp/htdocs -type d -exec chmod 755 {} \; | |
#find /opt/lampp/htdocs -type f -exec chmod 644 {} \; | |
# Show permissions in number format in ubuntu. #linux | |
# http://askubuntu.com/a/430685/205156 | |
alias perms="stat -c '%a - %n'" |
Edit mp3 tags:
Search for id3 in Software manager
and install eyeD3
remove all tags: eyeD3 --remove-all *
Set tags: eyeD3 -a artistName -A "album name" -t "title of music" -n 4 song.mp3
Install color emoji's #ubuntu:
source article: http://www.omgubuntu.co.uk/2016/05/emoji-one-font-linux-ppa-easy-install
sudo apt remove fonts-emojione-svginot
sudo apt install fonts-twemoji-svginot
test page: http://eosrei.github.io/emojione-color-font/full-demo.html
Unzip tar.gz file:
tar -xvzf filename.tar.gz
Change ownership of directories and files:
find . -type d -exec chown nobody:nobody {} \;
find . -type f -exec chown nobody:nobody {} \;
Make relative symbolic links.
(by copy folder to another place, symlinks are relative to copied folder)
cd target_location
ln -s -r ../../path/to/target/folder/or/file/ NAME_OF_SYMLINK
OR run this bash-file in target location. use * to create symlink for all files
mkdir target-folder
ln -r -s ./source-folder/*.ext ./target-folder/
Turn off external hard disk
udisksctl power-off -b /dev/sdX
replace sdX
with your hdd name (e.g. sdb or sdc)
Copy files/folders between computers (by ssh)
-r
(copy folders), -P 2020
(change port to 2020), -l 1024
(limit to 1Mbps)
scp source_file_name username@destination_host:destination_folder
you can change source and destination to change the direction of copy
zip all files in all subdirectories separately
gzip --keep --force -r dist
--keep to prevent delete original files
Show hardware informations
For important devices:
inxi -Fxz
Full details of CPU:
cat /proc/cpuinfo
and lscpu
Transfer files between two linux devices by scp
on host device:
sudo apt-get install openssh-server && sudo systemctl start ssh
on client device:
scp /path/to/file-or-folder/you-want-to-transfer.ext
host_username@host_ip:/path/to/destination`
Then enter host device password. Transfer will start.
Tip: You can use ssh-key instead password.
Pipe text to clipboard in terminal (by xclip)
(copy to terminal clipboard): echo "something" | xclip
copy to clipboard and use in other apps:
echo "something" | xclip -selection clipboard
Install from source
cd software_folder
./configure
make
make install # or sudo make install
more in https://www.linux.com/news/how-install-packages-source-linux/
screen command (toggle between multiple terminals)
sudo apt install screen
screen # then press space to continue
# run something on terminal, e.g. wget a 1TB file
# press Ctrl A + D to return to previous terminal
screen -r # to return to that terminal
# press Ctrl A + K to kill that terminal
screen -list # to see list of detached terminals
screen -r NUMBER # to attach to a terminal by it's id
See the temperature of CPU
cat /sys/class/thermal/thermal_zone*/temp
Create bootable USB
to find usb drive path: cat /dev/sd*
(if it is sdb1, use sdb instead)
sudo dd if=ubuntu-18.04-desktop-amd64.iso of=/dev/sdb
Switch keyboard keys
xev
and press any key to find the key codes, the output is something like this:
state 0x10, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
state 0x10, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
state 0x11, keycode 11 (keysym 0x40, at), same_screen YES,
Switch keys by:
xmodmap -e "keycode 78 = at"
Save to prevent reset after booting:
xmodmap -pke|egrep -e '78'
That will print a line like:
keycode 78 = at NoSymbol at
Create file ~/.Xmodmap
and copy to it.
Show local IP address
hostname -I
Connect to ssh and use server connection
ssh -fN -D 1080 user@remote
Open an application by defined proxy
proxychains4 -f /etc/proxychains4.conf [firefox, bash or something]
https://github.com/rofl0r/proxychains-ng
Fix mint 19 slow sleep (suspend) by adding usb c port to blacklist
Restart cinnamon when GUI is laggy
press alt + f2
anywhere, a dialog box will open, type r
and press Enter.
See hardware details
sudo apt install inxi
inxi -Fxz
Fix hibernate on ubuntu 20
apt remove --purge hibernate uswsusp
# /etc/default/grub
# add resume=UUID=###
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=7ef2fd85-9a9e-4fa9-a9c9-6c541d7944c9"
and edit (or create file)
# /etc/initramfs-tools/conf.d/resume
RESUME=UUID=###
* ### is the UUID of swap partition.
sudo apt install pm-utils
sudo pm-hibernate
https://www.linuxuprising.com/2018/08/how-to-use-swap-file-instead-of-swap.html
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1819915/comments/49
Install Nvidia optimus-manager in Manjaro distro (to switch between Intel and Nvidia GPUs easily)
Get ip of websites through Tor
tor-resolve WEBSITE_DOMAIN
Fix dns leak in OpenVPN (necessary to unblock filtering)
cd /tmp & git clone git@github.com:alfredopalhares/openvpn-update-resolv-conf.git
cd openvpn-update-resolv-conf
sudo cp update-resolv-conf.sh /etc/openvpn/
Then open your ovpn config file and add:
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Finally, connect to your server by:
sudo openvpn --config myconfig.ovpn
Resources:
https://wiki.archlinux.org/index.php/OpenVPN#The_update-resolv-conf_custom_script
https://github.com/alfredopalhares/openvpn-update-resolv-conf
Copy text between two VIMs.
Install GVim instead of vim which contains vim too, it has clipboard feature (check with vim --version | grep clipboard).
Select text and use "+y
to copy text to global clipboard register. then paste as normal text.
Clear DNS cache in manjaro
update /etc/hosts then sudo nscd -i hosts
Shred a partition (without ability to recover files)
sudo shred -v -n1 -z /dev/sdX
OpenVPN - exempt a website on VPN
Add this line for every website to .ovpn file:
route WEBSITE_IP 255.255.255.255 DEFAULT_GATEWAY
example for https://www.whatsmyip.org/
route 208.79.209.138 255.255.255.255 192.168.1.1
208.79.209.138 is the IP of the website.
Get the website IP by ping whatsmyip.org
Restart VPN.
Remove x (execute) permission for all files inside a directory:
chmod -R a-x+X directory/