DEV Community

Cover image for Linux Command Line:
Abdul Awal Nadim
Abdul Awal Nadim

Posted on • Edited on

Linux Command Line:

Linux is a powerful and widely used open-source operating system renowned for its stability, security, and flexibility. I am learning Linux Commands. If I see any command that is important or most frequently used, then I will add the command and description to the blog.

File and Folder Management:

ls

  • List Files and Directories:

example: Listing the contents of your home directory.

ls ~
Enter fullscreen mode Exit fullscreen mode

cd

  • Change Directory:

example: Moving into the Documents directory.

cd ~/Documents
Enter fullscreen mode Exit fullscreen mode

touch

  • Create Empty Files:

example: Creating a new text file named "example.txt."

touch example.txt
Enter fullscreen mode Exit fullscreen mode

mkdir

  • Create Directories:

example: Creating a directory named "projects."

mkdir projects
Enter fullscreen mode Exit fullscreen mode

cp

  • Copy Files and Directories:

example: Copying a file from one directory to another.

cp file.txt /path/to/destination/
Enter fullscreen mode Exit fullscreen mode

mv

  • Move/Rename Files and Directories:

example: Renaming a file.

mv oldfile.txt newfile.txt
Enter fullscreen mode Exit fullscreen mode

rm

  • Remove Files and Directories:

example: Deleting a file.

rm unwantedfile.txt
Enter fullscreen mode Exit fullscreen mode

File Permissions:

chmod

  • Change File Permissions:

example: Making a script executable.

chmod +x myscript.sh
Enter fullscreen mode Exit fullscreen mode

chown

  • Change File Ownership:

example: Changing the owner of a file.

chown newowner:groupname myfile.txt
Enter fullscreen mode Exit fullscreen mode

User and Group Management:

useradd

  • Add Users:

example: Adding a new user named "johndoe."

sudo useradd johndoe
Enter fullscreen mode Exit fullscreen mode

userdel

  • Delete Users:

example: Removing the user "johndoe."

sudo userdel johndoe
Enter fullscreen mode Exit fullscreen mode

passwd

  • Change User Passwords:

example: Changing the password for the user "johndoe."

sudo passwd johndoe
Enter fullscreen mode Exit fullscreen mode

groupadd

  • Create Groups:

example: Creating a group named "developers."

sudo groupadd developers
Enter fullscreen mode Exit fullscreen mode

groupdel

  • Delete Groups:

example: Removing the group "developers."

sudo groupdel developers
Enter fullscreen mode Exit fullscreen mode

usermod

  • Modify User Attributes:

example: Adding a user to the "developers" group.

sudo usermod -aG developers johndoe
Enter fullscreen mode Exit fullscreen mode

Editor

nano example.txt
Enter fullscreen mode Exit fullscreen mode

Create a Python environment in Linux (Ubuntu)

apt update
apt install python3.12
python3.12 --version
python3.12 -m pip

pip3.12 -V
python3.12 -m venv --help
sudo apt install python3.12-venv
----create environment Name "python-env-file"---
python3.12 -m venv python-env-file
------------"install all dependencies of requirements.txt"--------
pip3.12 install -r requirements.txt

Enter fullscreen mode Exit fullscreen mode

Top comments (0)