Guides
How website valuation actually works, what traffic estimates can and cannot tell you, and which once-standard metrics have quietly stopped existing.
Nginx: Block URL Access (wp-admin/wp-login.php) To All Except One IP Address
To block access to the URL wp-admin/wp-login.php for all IP addresses except one in nginx , you can use the following configuration in the server block for the website:rn rn rn location /wp-admin/wp-login.php {rn allow 192.168 .1 .100 ;rn deny all ;rn}rn rn rnThis configuration uses the location dir
AWK: Remove All Blank Spaces From String / Field
In awk , you can remove all blank spaces from a string or field using the gsub function. n For example, to remove all blank spaces from the first field of each record in a file: n n n awk '{ gsub (/ /,"",$ 1 ); print}' file .txt n n n In this example, the gsub function replaces all occurrences of a
VIM: Jump Back To Previous or Last Cursor Position
In vim , you can jump back to your previous or last cursor position by using the '' (two single quotes) command. The '' command takes you to the position where your cursor was before your last jump. For example, if you are editing a file and you move the cursor to a different location, you can pr
How To Check If a Directory Exists In a Shell Script
You can check if a directory exists in a shell script by using the if statement in combination with the test command or the ; then rn echo "Directory exists" rn else rn echo "Directory does not exist" rn fi rn rn rnUsing the rn then rn echo "Directory exists" rn else rn echo "Directory does not exis
How to create a new file with vim
To create a new file with the vim text editor, you can use the following command:rn rn vim filenamern rn rnWhere filename is the name of the file you want to create. Once the vim editor is open, you can start typing the content of your file. To save the file, press the Esc key to enter command mo
Debian Linux Install Eclipse Java / C / C++ IDE
You can install Eclipse on Debian-based systems, such as Debian or Ubuntu, by using the following steps:rn rn Download the latest version of Eclipse from the official Eclipse website ( https://www.eclipse.org/downloads/ ). rn Extract the downloaded archive to your preferred location using the follow
The Following Packages Were Automatically Installed And Are No Longer Required Warning
When you run certain package management commands, such as apt-get autoremove or apt autoremove , you may receive a warning message that states “The following packages were automatically installed and are no longer required”. This warning message means that the package manager has identif
Bash Function: Find Number Of Arguments Passed
In a Bash shell script, you can find the number of arguments passed to a function by using the $# special variable. The $# variable holds the number of arguments passed to the function. Here is an example of a simple function that prints the number of arguments passed to it:rn rn j rn find_argume
HowTo: Unix rm All Files In a Directory
To remove all files in a directory in a Unix-like system, you can use the following command: n n n rm -rf directory_name n n n The rm command is used to remove files or directories, and the -rf options are used to force the removal of the directory and its contents, including any files and subdirect
HowTo SSH Restart Mysql Server on a Linux and Unix Command Line
To restart the MySQL server on a Linux or Unix system over an SSH connection, you can use the following command:rn rn rn sudo service mysql restartrn rn rnThis command uses the sudo command to run the service command with superuser privileges. The service command is used to manage system services, a
Howto Extract Zip Files in a Linux and Unix-like Systems
To extract a ZIP file in a Linux or Unix-like system, you can use the following command:rn rn rn unzip filename. zip rn rn rnThis command will extract the contents of filename.zip into the current directory. The extracted files will have the same permissions and ownership as the original ZIP file.rn
Bash: .* Considered Harmful To Match Dot Files. Why?
In shell scripts, using the pattern .* to match dot files (files with names starting with a dot) is considered harmful because it may include unexpected files in the match. This is because .* matches any character zero or more times, including the / character. As a result, the pattern will match hid
Linux / Unix: Shell Remove Empty Lines
To remove empty lines from a text file in Linux or Unix, you can use the following command:rn rn rn grep . file.txt > output .txtrn rn rnThis command uses grep to search for lines that contain a period . and writes the matching lines to a new file called output.txt . This effectively removes all
Apache 2 Reload HTTPD Configuration File Without Restarting Apache Config Changes
To reload the Apache 2 HTTPD configuration file without restarting the Apache service, you can use the following command: n n n sudo apache2ctl graceful n n n The graceful option signals the Apache process to reload the configuration file and apply the changes without interrupting ongoing requests.
Vi / Vim: Wipe and Undo All Changes Since Opening a File
To wipe all changes and undo all modifications made to a file since it was opened in the vi or vim text editor, you can use the following command:rn rn rn :e! rn rn rnThis command discards all changes and reloads the file from disk, effectively undoing all changes made since the file was opened.
How to tar a file in Linux using command line
The tar command in Linux is used to create and extract archive files. To create a .tar archive file from one or more files or directories, you can use the following syntax:rn rn rn tar -cvf archive.tar file1 file2 directory1rn rn rnIn this example, -c option is used to create an archive, -v option i
Debian / Ubuntu: Install gem The FrontEnd To Rubygems
To install the gem package on Debian or Ubuntu, you can use the following steps:rn rn Update the package index: rn rn rn rn sudo apt - get update rn rn rn rn Install the ruby and rubygems packages: rn rn rn rn sudo apt- get install ruby rubygemsrn rn rn rn Verify that the gem package is installed by
Debian / Ubuntu: Set Port Knocking With Knockd and Iptables
Port knocking is a security technique used to hide services on a network behind a firewall until a specific sequence of connection attempts (knocks) is received. To set up port knocking on Debian or Ubuntu, you will need to install two components: knockd , which acts as the daemon that listens fo
CentOS / RHEL 5/6: Uninstall Apache (HTTPD) Server
To uninstall the Apache (HTTPD) server on CentOS or Red Hat Enterprise Linux (RHEL) 5/6, you can use the following steps:rn rn Stop the Apache service: rn rn rn rn service httpd stop rn rn rn rn Remove the Apache packages: rn rn rn rn yum remove httpdrn rn rnThis will remove the Apache packages and
Linux / Unix: Dig Command Find Out TTL (Time to Live) Value For DNS Records
The dig command can be used to find out the Time to Live (TTL) value for DNS records. The TTL value is the amount of time in seconds that a DNS record will be cached on a local DNS resolver before it needs to be refreshed. Here's how you can use the dig command to find the TTL value for a specifi
2,685 guides published.
