0% found this document useful (0 votes)
10 views4 pages

Linux-Commands

The document provides a comprehensive list of essential Linux commands categorized by their functions, including file system navigation, file management, process management, user management, networking, and software installation. Each command is accompanied by a brief description of its purpose. This serves as a quick reference guide for users to efficiently operate within a Linux environment.

Uploaded by

Lester Divino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Linux-Commands

The document provides a comprehensive list of essential Linux commands categorized by their functions, including file system navigation, file management, process management, user management, networking, and software installation. Each command is accompanied by a brief description of its purpose. This serves as a quick reference guide for users to efficiently operate within a Linux environment.

Uploaded by

Lester Divino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Linux Commands and Their Purpose

Navigating the File System

● pwd – Shows your current directory (Print Working Directory).

● ls – Lists files and folders in the current directory.

● cd /home – Changes directory to /home.

● cd ~ – Takes you to your home directory.

Working with Files and Directories

● mkdir test_directory – Creates a new folder called test_directory.

● cd test_directory – Enters the test_directory.

● touch test_file.txt – Creates an empty file named test_file.txt.

● echo "Hello, Linux!" > test_file.txt – Writes text into test_file.txt.

● cat test_file.txt – Displays contents of the file.

Managing Files

● mv test_file.txt new_file.txt – Renames the file.

● cp new_file.txt backup.txt – Copies file to a new one.

● rm new_file.txt – Deletes the file.

● ls – Re-checks the directory contents.

Process Management

● ps – Lists currently running processes for the user.

● ps aux | grep bash – Searches for bash in all running processes.

● clear – Clears the terminal screen.


🔹 Getting Help

● man ls – Opens the manual/help page for the ls command.

User Management

● whoami – Displays the current username.

● cat /etc/passwd – Shows all system users.

● sudo useradd newuser – Adds a new user (replace newuser with actual name).

● sudo passwd newuser – Sets a password for the new user.

● su - newuser – Switches to the new user account.

● exit – Logs out of the current user session.

File Permissions

● touch myfile.txt – Creates a new file.

● ls -l myfile.txt – Shows file permissions and ownership.

● chmod +x myfile.txt – Makes the file executable.

● sudo chown newuser myfile.txt – Changes the file owner to newuser.

Networking

● ip a – Displays IP address and network interfaces.

● ping -c 4 google.com – Pings Google to test connectivity (sends 4 packets).

● netstat -tulnp – Shows active network connections and listening ports.

● hostname – Displays the computer’s hostname.


Process Control

● pgrep bash – Gets the process ID (PID) of bash.

● sleep 1000 & – Starts a dummy background process that sleeps for 1000
seconds.

● pgrep sleep – Finds the PID of the sleep process.

● sudo kill [PID] – Stops the process with the given PID.

● sudo kill -9 [PID] – Forcefully stops a process.

User and Group Management

● sudo adduser advanceduser – Creates a user named advanceduser.

● sudo groupadd advancedgroup – Creates a group named advancedgroup.

● sudo usermod -aG advancedgroup advanceduser – Adds user to the group.

● groups advanceduser – Checks group memberships of the user.

Software Installation and Uninstallation

● sudo apt update – Updates the list of available packages.

● sudo apt install vlc – Installs VLC Media Player.

● vlc --version – Verifies that VLC was installed.

● sudo apt remove vlc – Uninstalls VLC (leaves config files).

● sudo apt purge vlc – Removes VLC including config files.

● sudo apt autoremove – Deletes unused packages to clean up space.

File and System Monitoring

● top – Shows live system usage (CPU, memory, processes).

● iostat – Displays disk I/O statistics (requires sysstat).


● sudo apt install sysstat – Installs the iostat tool.

You might also like