Categories
Linux Useful

Change the extension of multiple files in Linux

1). Using Linux find command Using find command to rename all .oldext files under directory structure with a new extension: .newext find . -type f -name “*.oldext” -exec rename ‘s/\.oldext$/.newext/’ ‘{}’ \; 2). Using Linux find command, but in a different approach for f in `find . -iname ‘*.oldext’ -type f -print`;do mv “$f” ${f%.oldext}.newext; […]

Categories
Linux Useful

du – Get the Size of a Folder in Ubuntu Linux

The linux du command displays the size of file space used by the specified files or folders. If the specified path is a directory (folder), du summarizes disk usage of each subdirectory in that directory. Otherwise, du reports the disk usage of the current working folder. To get the total size of the /srv folder, […]

Categories
Linux Security Servers

Install OpenVPN, DNSCrypt and Pi-Hole – Ubuntu 20

Step by step: Install OpenVPN + Pi-Hole ad-blocker + DNSCrypt-proxy for DoH and DNSSEC Step 1. Update the system: sudo apt update sudo apt upgrade Step 2. Install OpenVPN: wget https://git.io/vpn -O openvpn-install.sh chmod 755 openvpn-install.sh sudo ./openvpn-install.sh Generated opvn file can be used with an OpenVPN client in PC or cell phone. It can be […]

Categories
Linux

Detach script/command in Linux – Easy Way !

Hot to start and detach bash script (or command) in linux from the command line: setsid nohup monitor.sh & detach script/command with custom log: setsid nohup monitor.sh &>/tmp/monitor.log & And to check the result, use a linux command that shows the process hierarchy: [email protected]:/usr/local/bin# ps -efj –forest

Categories
Linux

Kill Process in Linux by PID, Name or Group

Kill a Process in Linux from command line using kill command: kill process by name: kill $(ps aux | grep ‘process_name’ | awk ‘{print $2}’) kill process by ID kill -9 PID Kill all descendant/recursively processes The easy way to do this in a shell script is using pkill command: pkill -TERM -P 123456 where […]

Categories
Linux Useful

Find Available Network Interfaces On Linux/Ubuntu – 6 Quick Solutions

If you need a solution for quickly finding information about the network interfaces attached to the server or computer, then choose one of the solutions below, any of which is useful for certain technical situations. 1) using lshw , a small tool to extract detailed information on the hardware configuration of the machine: [email protected]:/# sudo […]

Categories
Linux

Reload fstab (/etc/fstab) – dynamic loading without restart – Linux

When we make a change in the /etc/fstab file in order to be active (ie taken into account) we need to notify the operating system to refresh the commands in fstab or to restart the system, which is not mandatory! So, to reload the commands from fstab, in linux we have the mount command, which […]

Categories
Linux Servers

How to Change Partition Label Names on Linux: EXT4 / EXT3 / EXT2

The most popular options are to use commands e2label or tune2fs used for changing label of ext4, ext3 or ext2 type partitions: # e2label /dev/sdf1 EXTLABEL and/or # tune2fs –L EXTLABEL /dev/sdf1 For other file filesystem, some less used in the linux environment: NTFS ntfslabel /dev/sdf1 NTFSLABEL SWAP mkswap -L SWAPLABEL /dev/sdf1 exFAT exfatlabel /dev/sdf1 […]

Categories
Linux Servers Useful

Reload new entry in fstab – fast and easy way – Linux

A fast and easy way to reload new entries in /etc/fstab is to use the linux mount command: @ sudo mount -a or with verbose mode: @ sudo mount -av / : ignored /boot : already mounted /boot/efi : already mounted //srv/TOSHIBA-3T-V300 : already mounted //srv/WD-2T-USB : already mounted //srv/TOSHIBA-3T-ENTERPRISE: already mounted //srv/SAMSUNG-850-PRO : already […]

Categories
Linux Useful

View the file size of a directory in LINUX – Folders and Subfolders

If we want to see what is the size occupied by folders or subfolders in linux, we can use the du command, that is a command line utility for reporting file system disk space usage. It can be used to find out disk usage for files or folders and to show what is taking up […]