curl command cheat sheet

In this tutorial, I have compiled a comprehensive curl command cheat sheet. Curl is a powerful command-line tool for making HTTP requests and working with various protocols. The cheat sheet is designed to serve as a quick reference guide, providing concise and organized information on the essential curl commands. Whether you're a beginner or an experienced user, this resource aims to simplify the usage of curl commands, helping you navigate and leverage its capabilities efficiently. Feel free to explore the cheat sheet and enhance your proficiency in utilizing curl for various web-related tasks. curl command cheat sheet Option -o <file>       # --output: write to file -u user:pass  # --user: Authentication -v                  # --verbose -s                  # --silent -I                  # --head: headers only -i                  # --include: Include the HTTP-header in the output Request -X POST          # --request -L                     # follow link if page redirects -F  

How to enable SSH 2FA on AlmaLinux

 In this tutorial, How to enable two-factor authentication (2FA) for SSH logins.  Install the Google Authenticator on AlmaLinux sudo dnf install epel-release -y sudo dnf install google-authenticator qrencode qrencode-libs -y After install completes, I will create a new secret key in ~/.ssh directory Run command as follows google-authenticator -s ~/.ssh/google_authenticator The output terminal as below [root@DevopsRoles ~]# google-authenticator -s ~/.ssh/google_authenticator Do you want authentication tokens to be time-based (y/n) y Warning: pasting the following URL into your browser exposes the OTP secret to Google:|0&cht=qr&chl=otpauth://totp/[email protected] Your new secret key is: DXFSMCJ42VQ7FPMS2VAJ3CIJIE Your verification code is 222214 Your emergency scratch codes are:   36072722   12212187   31577834   31344084   92578576 Do you want me to update y

speed test command line linux

 In this tutorial, How to  run a Speedtest from your command line. The requirement Nodejs version > 8+.    Install speed test command line [vagrant@localhost ~]$ wget [vagrant@localhost ~]$ tar xvf node-v14.15.4.tar.gz [vagrant@localhost ~]$ cd node-v14.15.4/ [vagrant@localhost node-v14.15.4]$ sudo ./configure [vagrant@localhost node-v14.15.4]$ sudo make [vagrant@localhost node-v14.15.4]$ sudo make install Use NPM install speed test [vagrant@localhost ~]$ sudo npm install --global speed-test  The result, Install speed-test [vagrant@localhost node-v14.15.4]$ sudo npm install --global speed-test /usr/local/bin/speed-test -> /usr/local/lib/node_modules/speed-test/cli.js + [email protected] updated 2 packages in 10.4s [vagrant@localhost node-v14.15.4]$ Usage speed-test [vagrant@localhost node-v14.15.4]$ speed-test --help   Test your internet connection speed and ping using from the CLI   Usage     $ speed-test   Optio

Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed]

 In this tutorial, How to connect to WiFi ubuntu server on Rasberry Pi  4. Today, I buy Rasberry PI 4 new and install ubuntu 20.04 LTS. root@ubuntu:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS" root@ubuntu:~#  after finish, Rasberry Pi 4 no identify ip address of wilfi. :D.  Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed] The first, check network interface your system. ll -la /sys/class/net/ Create new file config for wifi " /etc/netplan/wlan.yaml" apply configure and reboot netplan apply The result, as below root@ubuntu:~# ll -la /sys/class/net/ total 0 drwxr-xr-x  2 root root 0 Jan  1  1970 ./ drwxr-xr-x 74 root root 0 Jan  1  1970 ../ lrwxrwxrwx  1 root root 0 Jan  1  1970 eth0 -> ../../devices/platform/scb/fd580000.ethernet/net/eth0/ lrwxrwxrwx  1 root root 0 Jan  1  1970 lo -> ../../devices/virtual/net/lo/ lrwxrwxrwx  1 root root 0 Apr  1  2020 wlan0 -> ../.

How to change the order of columns in the output

In this tutorial, How to change the order of columns in the output of `uniq -c` command. I use read the file and show the unique Name from the file. How many time this name of the file? The content of file as example below [HuuPV@DevopsRoles ~]$ cat devopsroles.txt  huu huu phan van dev devopsroles dev huu huu I use awk, sort uniq command to read file and show the unique Name as example below [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr       4 huu       2 dev       1 van       1 phan       1 devopsroles Now, How to change the order of columns in the output of file [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{ print $2,$1}' huu 4 dev 2 van 1 phan 1 devopsroles 1 [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{ print $1,$2}' 4 huu 2 dev 1 van 1 phan 1 devopsroles Conclusion  How to change the order of

ntfsfix fix NTFS not mount from Linux

Today, I have not mount usb external USB into Fedora 32. External USB drive is NTFS formatted.  I will installed ntfs-3g  package for fedora as below: sudo dnf install ntfs-3g ntfsprogs The first, check your device address , you run this command as below sudo fdisk -l # or lsblk -f The output device is /dev/sd XY (where X and Y are the letter of the drive's device and Y is the partition number).  So in my case /dev/sdc1 is usb  drive external NTFS formatted. you will replace "device name" with your windows partition ( ex: /dev/sdb1 or /dev/sdd1 .v.v) How to do fix it Now, Open your terminal and run command to fix a Corrupted Windows NTFS Filesystem with Linux [HuuPV@DevopsRoles ~]$ sudo ntfsfix /dev/sdc1 Mounting volume... $MFTMirr does not match $MFT (record 0). FAILED Attempting to correct errors... Processing $MFT and $MFTMirr... Reading $MFT... OK Reading $MFTMirr... OK Comparing $MFTMirr to $MFT... FAILED Correcting differences in $MFTMirr record 0...OK Processing

Fix semanage command not found in Centos 8

 In this tutorial, I have fix semanage command not found in Centos 8. Semanage is an SELinux (Security-Enhanced Linux) management tool  Error semanage command not found in Centos 8  bash: semanage: command not found I use yum command  [root@DevopsRoles ~]# yum provides /usr/sbin/semanage The terminal output as below: Last metadata expiration check: 1:04:49 ago on Sun 09 Aug 2020 12:50:49 PM UTC. policycoreutils-python-utils-2.9-9.el8.noarch : SELinux policy core python utilities Repo        : BaseOS Matched from: Filename    : /usr/sbin/semanage It's missing policycoreutils-python-utils package in Centos 8. Now, I install package it. [root@DevopsRoles ~]# yum install policycoreutils-python-utils Once the install complete, you try semanage command on Centos 8. # man semanage OR # semanage --help I hope this helps you! have a nice day!

How to Upgrade php version on Centos 7

 In this tutorial, How to upgarde php version on Centos 7. My Server have installed php71. I will upgrade php to version php74 Type the following command to check the current version PHP. # php -v # yum list installed | grep -i php Now, Let go upgade php version to php74 If your has no remi repo, then Turn on Remi repo: # yum install Install yum-utils package # yum install yum-utils If you want to install PHP 7.1, PHP 7.2, PHP 7.3 or PHP 7.4 on CentOS 7. Just enable it as below # yum-config-manager --enable remi-php71 # yum-config-manager --enable remi-php72  # yum-config-manager --enable remi-php73 # yum-config-manager --enable remi-php74 For exmaple, I will chose php74 in this tutorial. # yum-config-manager --enable remi-php74 Update Centos 7  server. # yum update Checking version one more time # php -v You have update php version to php74 running on Centos 7 Server.

How to Install Specific Version of Package use YUM

In this tutorial, I will use YUM command to install specific version of Package. Step 1: How to list the available package version in our repository. Syntax: # yum --showduplicate list [package_name] For Example [root@devopsroles ~]# yum --showduplicate list nodejs Remi's Modular repository for Enterprise Linux 8 - x86_64                                                                                                                          207 kB/s | 539 kB     00:02 Safe Remi's RPM repository for Enterprise Linux 8 - x86_64                                                                                                                         388 kB/s | 1.4 MB     00:03 Available Packages nodejs .x86_64                                                                            1:10.19.0-1.module_el8.1.0+277+2bccb1a9                                                                            AppStream Step 2: Install the specific version of the nodejs packag

How to resolve Error: rpmdb open failed In CentOS

In this tutorial, How to resolve Error: rpmdb open failed Error In CentOS. I was testing on nginx web server in Centos 7 VM Linode . Unfortunaely, I have install new package with yum command , I got this error message: error: rpmdb: BDB0113 Thread/process 3050/139803232012096 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 -  (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed It seemes like YUM broke down. I have not run any yum command. Solve problem, just do the following steps.   First backup the rpm database using command as root user: # mv /var/lib/rpm/__db* /tmp Run the following command: # yum clean all # yum update Clean backup # rm -i /tmp/__db* I hope this helps you.