0% found this document useful (0 votes)
9 views

Linux Commands New

The document lists many common Linux commands for system information, file and directory management, user management, process management, network management, log management, package management, disk usage, system shutdown and restart, and miscellaneous tasks. It provides a brief description for each command.

Uploaded by

Ramesh Chalwadi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Linux Commands New

The document lists many common Linux commands for system information, file and directory management, user management, process management, network management, log management, package management, disk usage, system shutdown and restart, and miscellaneous tasks. It provides a brief description for each command.

Uploaded by

Ramesh Chalwadi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

list of common Linux commands at the L1/L2 level that can be helpful for management

and troubleshooting:

### System Information


- **`uname -a`**: Displays system information, including the kernel version.
- **`hostname`**: Shows the system’s hostname.
- **`uptime`**: Shows how long the system has been running, along with load
averages.
- **`df -h`**: Displays disk space usage in a human-readable format.
- **`free -h`**: Displays memory usage in a human-readable format.
- **`top`**: Displays real-time system processes and resource usage.
- **`htop`**: An enhanced version of `top` (may need to install).
- **`lscpu`**: Displays information about the CPU architecture.
- **`lsblk`**: Lists all block devices and their mount points.

### File and Directory Management


- **`ls`**: Lists files in a directory.
- **`cd`**: Changes the current directory.
- **`cp`**: Copies files or directories.
- **`mv`**: Moves or renames files or directories.
- **`rm`**: Removes files or directories.
- **`mkdir`**: Creates a new directory.
- **`rmdir`**: Removes an empty directory.
- **`find /path/to/search -name filename`**: Searches for files by name.

### User Management


- **`whoami`**: Displays the current user.
- **`id`**: Shows user and group information for the current user.
- **`useradd username`**: Adds a new user.
- **`usermod -aG groupname username`**: Adds a user to a group.
- **`passwd username`**: Changes a user’s password.
- **`groupadd groupname`**: Creates a new group.

### Process Management


- **`ps aux`**: Displays a snapshot of current processes.
- **`kill PID`**: Kills a process by its Process ID (PID).
- **`pkill process_name`**: Kills processes by name.
- **`bg`**: Resumes a suspended job in the background.
- **`fg`**: Brings a background job to the foreground.

### Network Management


- **`ifconfig`** or **`ip addr`**: Displays network interfaces and their
configuration.
- **`ping hostname`**: Tests connectivity to a host.
- **`traceroute hostname`**: Traces the route packets take to a network host.
- **`netstat -tuln`**: Lists listening ports and active connections.
- **`ss -tuln`**: Shows socket statistics (more modern than `netstat`).
- **`curl http://example.com`**: Fetches a URL to test connectivity.
- **`nslookup domain.com`**: Queries DNS to get domain information.

### Log Management


- **`tail -f /var/log/syslog`**: Monitors the system log in real time.
- **`cat /var/log/auth.log`**: Displays authentication-related logs.
- **`dmesg`**: Displays kernel ring buffer messages.

### Package Management (Debian/Ubuntu)


- **`apt update`**: Updates package lists.
- **`apt upgrade`**: Upgrades installed packages.
- **`apt install package_name`**: Installs a package.
- **`apt remove package_name`**: Removes a package.

### Package Management (Red Hat/CentOS)


- **`yum update`**: Updates packages.
- **`yum install package_name`**: Installs a package.
- **`yum remove package_name`**: Removes a package.

### Disk Usage


- **`du -sh /path/to/dir`**: Displays the disk usage of a directory.
- **`du -h --max-depth=1`**: Displays the size of directories at a specific depth.

### System Shutdown/Restart


- **`shutdown now`**: Immediately shuts down the system.
- **`reboot`**: Restarts the system.
- **`poweroff`**: Powers off the machine.

### Miscellaneous
- **`history`**: Displays the command history.
- **`man command`**: Displays the manual page for a command.
- **`chmod permissions filename`**: Changes the permissions of a file.
- **`chown user:group filename`**: Changes the owner and group of a file.

These commands cover a range of basic system management and troubleshooting tasks.
Make sure to use commands with caution, especially those that modify or delete
files and processes.

You might also like