Show the Top 10 Largest Directories on Linux
If you need to see the top 10 largest directories on your Linux system, you can use the following command:
du -h --max-depth=1 / | sort -rh | head -n …50 articles about linux development, tools, and best practices
If you need to see the top 10 largest directories on your Linux system, you can use the following command:
du -h --max-depth=1 / | sort -rh | head -n …If you need to set the hostname on a linux server, and you are using Terraform, then you can do the following:
Include the provisioner block and set …
mysql -u root -p
select @@datadir;
Output:
+-----------------+
| @@datadir | …
Read Article →
If you need to sync the clock on Linux using the central NTP clock service, you can do the following:
sudo service ntp stop
sudo ntpd -gq
sudo service …
Read Article →
If using the EC2 launch type, the allowable network mode depends on the underlying EC2 instance’s operating system. If Linux, awsvpc, bridge, host and …
Read Article →This guide showcases the ability to use imported certificates from a third party provider (e.g. Venafi) in ACM, mount them in EFS and use them …
Read Article →If you need to check if a volume is mounted in a Bash script, then you can do the following.
First we need to determine …
Read Article →If you need to check if a bash variable is empty, or unset, then you can use the following code:
if [ -z "${VAR}" ];
The above code will check …
Read Article →If you use the du command to list all the file sizes on Linux:
du
# or
du -h # Human readable
Then you would have noticed that they are not ordered by …
Read Article →If you need to resize an EBS volume in AWS, you can do so using bash.
bash fileCreate a bash file called resize.sh:
#!/bin/bash …
Read Article →
If you need to count how many files are in a directory on Linux, then you can use a combination of the ls command to list all the files, and the wc …
If you want to execute Linux commands in Golang, you can use exec.Command from the os/exec package:
cmd := exec.Command("echo", "hello …If you need to get the CPU frequency in Linux, you can run the following command:
watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
This …
Read Article →Sometimes you might want to exit a command if a variable is not set in Bash.
You can do this as follows:
if [ -z "$VARIABLE_NAME" ]; then echo …
Read Article →
If you need to check the version and flavour of the running Linux instance, then you can try the below commands:
cat /etc/os-release
lsb_release -a …
Read Article →
You have 3 options here:
I needed this when doing bulk find-and-replace across config files in a deployment script. The -i option is the most common …
If you find yourself in a position where you need to sync all emails from one account to another, then you can use the imapsync command-line tool to …
You can download and install the AWS CLI v2 on Linux as follows. This works on most x86_64 Linux distributions including Ubuntu, Amazon Linux, and …
Read Article →If you need to reboot, or restart the networking interface on your Mac, by using the CLI, then you can issue the following commands:
If you have come across the following error:
ZipArchive extension: <strong>disabled/not installed</strong>
This just means that …
Read Article →If you have a file on your machine, and you want to change the created/modified time/date stamp, then you can use the touch command.
touch -t …
Read Article →
If you need to query meta-data information from your running EC2 instance, you can curl the following location:
curl …
Read Article →
If you need to view a list of all the services that are either running or stopped (or both) on an Ubuntu server, then you can use the following …
Read Article →Upgrading an Ubuntu Server is quite easy, just follow the below commands:
sudo apt-get update && sudo …
Read Article →