Posts

Showing posts with the label Linux Commands

speed test command line linux

Image
 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 https://nodejs.org/dist/v14.15.4/node-v14.15.4.tar.gz [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 speedtest.net from the CLI   Usage     $ speed-test   Optio

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 Install Specific Version of Package use YUM

Image
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

Remove old kernels in CentOS, RHEL and Fedora

Image
Your system to many old kernels version. How to remove old kernels in CentOS , RHEL and Fedora . For example, I have three kernel,and to keep two kernel on system. How to do it! To check kernel release on centos/RHEL and Fedora [huupv@huupv ~]$ uname -sr The output kernel release as below: Linux 4.15.15-300.fc27.x86_64 Checking installed kernel [huupv@huupv ~]$ rpm -q kernel The output three kernel as below: kernel-4.15.13-300.fc27.x86_64 kernel-4.15.14-300.fc27.x86_64 kernel-4.15.15-300.fc27.x86_64 Delete / Remove Old Kernels To install yum-utils [root@huupv huupv]# yum install yum-utils The output as below: Last metadata expiration check: 2:54:35 ago on Sat 14 Apr 2018 07:14:37 PM +07. Dependencies resolved. ================================================================================  Package                  Arch        Version                 Repository   Size ================================================================================ Installi

Checks for open/closed ssh ports using nmap command

Image
Introduction Welcome to our detailed guide on how to check for open and closed SSH ports. In today's networked world, maintaining secure server connections is critical. Secure Shell (SSH) is a network protocol that provides administrators with a secure way to access a remote computer.  However, ensuring that your SSH ports are configured correctly is essential to prevent unauthorized access and breaches.  This tutorial will provide you with step-by-step instructions on using various tools to determine the status of SSH ports on your system. Whether you're a seasoned system administrator or a novice user, these skills are fundamental to managing and securing your network connections. In this tutorial, How to checks all ports if they are closed or open and if the current ssh version? Using nmap command. Read man nmap page. First, you need to install nmap . For ubuntu $ sudo apt-get install nmap For centos $ sudo yum install nmap For example, checks for open/closed ports

Upgrading Fedora 28 to Fedora 29

Image
I using fedora 28 my laptop. Now I will "Upgrading Fedora 28 to Fedora 29" . Fedora 29 was just officially releases . Before not yet Upgrading to Fedora 29. [huupv@huupv huuphan.com]$ cat /etc/redhat-release Fedora release 28 (Twenty Eight) Using the command line to Upgrading Fedora 28 to Fedora 29 Update software and backup your system [huupv@huupv huuphan.com]$ sudo dnf upgrade --refresh Install the DNF plugin [huupv@huupv huuphan.com]$ sudo dnf install dnf-plugin-system-upgrade Start the update with DNF [huupv@huupv huuphan.com]$ sudo dnf system-upgrade download --releasever=29 Reboot and upgrade [huupv@huupv huuphan.com]$ sudo dnf system-upgrade reboot

top command in linux

Image
I guide to the Linux " Top command ". The top command allow monitor processes and system resource usage on Linux. It is a best tools for system admin. Top command in linux Getting start top command you can type "top" in terminal very simple. [huupv@huupv huuphan.com]$ top  If you want to quit, then press "q" The screen output terminal as below Top command usage example How to killing processes, sorting the process list, showing full paths, forest view and Listing processes from an user. Killing processes you want to kill a process, press "k" when top command is running and ask for the process ID and press enter. If you leave the process ID blank and hit enter. Sorting the process list The most frequent reasons to use a tool like top is to find out the consuming the most resources. you can press key for sorting list. ‘M’ to sort by memory usage ‘P’ to sort by CPU usage ‘N’ to sort by process ID ‘T’ to sor

ls command

Image
In this tutorial, How do i use ls command. The syntax ls command ls [Option] Full list [Option] of ls command ls -a list all files including hidden file starting with '.' ls -r list in reverse order ls -R list recursively directory tree ls -s list file size ls -S sort by file size ls -t sort by time & date ls -X sort by extension name ls --color colored list [=always/never/auto] ls -d list directories - with ' */' ls -F add one char of */=>@| to enteries ls -i list file's inode index number ls -l list with long format - show permissions ls -la list long format including hidden files ls -lh list long format with readable file size ls -ls list with long format with file size For example List all files and folder with option list reverse order, sort by time & date [huupv@huupv huuphan.com]$ ls -lrt The different between files and folders and symbolic link and other with ls -F option [huupv@huupv huuphan.com]$ ls -F Here, "/&