Skip to main content

Command Palette

Search for a command to run...

๐Ÿ“ˆ Beyond Basics: Using Advanced Linux ๐Ÿง Commands

Part 2

Updated
โ€ข3 min read
๐Ÿ“ˆ Beyond Basics: Using Advanced Linux ๐Ÿง Commands

๐Ÿ‘‰ Quick Intro ๐Ÿ”ฅ

In this blog, I will explain advanced commands related to:-

  1. Process management

  2. Package management

  3. System information

  4. Networking commands

๐Ÿ‘‰ Process Management โš™๏ธ

  • As Linux is multiuser & multitasking OS it has multiple processes running at same

  • To get data on all those processes we have ps command

  • To find which services are running on which ports on, you can use netstat -tuln

  1. Display Processes

    ps --> View running processes

    ๐Ÿšฉ FLAGS

    -A --> View all running processes

    -e --> View all running processes

    -f --> View full-format listing

    -a --> View all processes except session leaders & not associated with terminal

    -x --> View all processes owned by you

    ps -ef --> View all running processes in a detailed format. [most commonly used]

    ps -aux --> View all running processes owned by you in a detailed format

  2. Find Process

    To find a particular running process you can use pipe with grep command

    You can get PID in the second column

  3. Kill Process

    To kill process kill command is used

    kill PID --> Kill process using PID

    kill <signal> PID --> Kill process with some extra signal

    ๐Ÿšฆ SIGNALS

    | SIGKILL | 9 | It kills signal forcefully without any cleanup activities. | | --- | --- | --- | | SIGTERM | 15 | Before terminating the process, it does some cleanup activities. |

    kill -9 PID OR kill -SIGKILL PID

    kill -15 PID OR kill -SIGTERM PID

    kill -l --> Display all signals

๐Ÿ‘‰ Package Management ๐Ÿ“ฆ

  • Different distros have different package managers

    yum for Amazon Linux / Cent OS / Red Hat

    apt and apt-get for Ubuntu / Debian

    deb

apt-getapt
Less user friendlyMore user-friendly, like a progress bar
Search not availableAvailable

sudo apt update -y --> Update existing packages

sudo apt search <package-name> --> Search package

sudo apt install <package-name> -y --> Install new package

sudo apt remove <package-name> -y --> Uninstall package

cat /etc/apt/sources.list --> This file has all repositories from where packages are downloaded

๐Ÿ‘‰ System Information ๐Ÿ’ป

  • uname gives general information about OS, architecture & system

    ๐Ÿšฉ FLAGS

    -a --> Print all data

    -s --> Give kernel name

    -n --> Hostname

    -r --> Kernel release date

    -v --> Version of the current kernel

    -m --> Machine hardware name

    -p --> Type of processor

    -i --> Platform of hardware

    -o --> Name of OS

  • df is used to get storage-related data of all mounted file systems

  • du command gives file and directory space usage

    ๐Ÿšฉ FLAGS

    -a --> Include all files and directories, including hidden ones

    -c --> Give total disk usage in addition to individual ones

    -h --> Human readable sizes

    --time --> Give the last modified time also

  • lsblk gives data of block devices and mounted storages

  • uptime is used to find out how long the system is running

    ๐Ÿšฉ FLAGS

    -p --> Human readable

    -s --> Starting date & time

  • lscpu gives all the details about the CPU

๐Ÿ‘‰ Networking ๐ŸŒ

  • ping <URL/IP> is used to check if the server is running

  • ifconfig gives details about interfaces and private IP address

  • netstat displays network-related information such as network connections, routing tables, interface statistics, etc.

  • wget is a non-interactive network downloader that is used to download files

    ๐Ÿšฉ FLAGS

    -b --> Download in background [this creates a logfile]

    -c --> Resume partially downloaded file

Happy Learning!!! ๐Ÿ‘‹