Top 50 Basic Linux Commands Every Beginner Should Know. (Tutorial 1)

Top 50 Basic Linux Commands Every Beginner Should Know. (Tutorial 1)

1. File and Directory Management.

File and directory management in Linux is an essential part of system administration and user operations. Linux organizes data in a hierarchical structure, starting from the root directory /. Files are used to store data, while directories act as containers for organizing these files. Common commands like ls, cd, pwd, mkdir, and rmdir help users navigate and manage directories. Commands such as cp, mv, and rm are used to copy, move, or delete files. The touch command creates new empty files, and cat or nano can display or edit their contents. Permissions and ownership, managed with chmod, chown, and chgrp, ensure security and access control. Hidden files start with a dot (.) and can be viewed with ls -a. Efficient file management allows smooth system operation and better organization of user data.

1. pwd – Print the current working directory.

  • pwd

2. ls – List files and directories.

  • ls -l # Long listing
  • ls -a # Include hidden files

3. cd – Change directory.

  • cd /path/to/directory
  • cd .. # Move up one directory

4. mkdir – Create a directory.

  • mkdir myfolder
  • mkdir -p dir1/dir2/dir3 # Create nested directories

5. touch – Create an empty file or update timestamps.

  • touch file.txt

6. cp – Copy files or directories.

  • cp file.txt /path/to/destination
  • cp -r dir1/ dir2/ # Copy directories recursively

7. mv – Move or rename files or directories.

  • mv file.txt /path/to/destination
  • mv oldname.txt newname.txt # Rename a file

8. rm – Remove files or directories.

  • rm file.txt
  • rm -r dir/ # Remove directories recursively

9. find – Search for files or directories.

  • find /path -name “file.txt”
  • find /path -type f -mtime +7 # Find files modified more than 7 days ago

2. Text Processing

Text processing in Linux is a powerful feature used to handle and manipulate text files efficiently. Linux provides various command-line tools for viewing, searching, filtering, and editing text. Commands like cat, less, and more are used to display file contents. The grep command helps search for specific patterns or keywords within files. Tools such as awk and sed allow advanced text manipulation, including formatting and replacing text. The sort command arranges lines in a specific order, while uniq removes duplicates. cut and paste are used to extract or combine text columns. tr can translate or delete characters in text streams. These commands can also be combined using pipes (|) to perform complex operations in a single line. Overall, Linux text processing makes managing large amounts of data fast, flexible, and efficient.

1. cat – Display file content.

  • cat file.txt

2. grep – Search text using patterns.

  • grep “pattern” file.txt
  • grep -i “pattern” file.txt # Case-insensitive search

3. System Information.

System information in Linux helps users and administrators understand the hardware and software configuration of their system. Commands like uname -a display kernel and system details, while hostnamectl shows system name and OS information. The lsb_release -a command provides distribution-specific details such as version and codename. To check hardware information, lscpu shows CPU details, and lsblk lists storage devices. Memory usage can be viewed using free -h, and disk space with df -h. The top or htop commands display real-time system processes and resource usage. Network details can be found using ifconfig or ip addr. For PCI and USB devices, lspci and lsusb are used. Collectively, these commands give a clear picture of the system’s performance, components, and status, helping in troubleshooting and optimization.

1.uname – Display system information.

  • uname -a # Show all system information

2. df – Display disk space usage.

  • df -h # Human-readable format

3. du – Display directory space usage.

  • du -sh /path/to/directory # Summarize directory size

4. top – Display system processes.

  • top

5. ps – Display running processes.

  • ps aux

6. free – Display memory usage.

  • free -h # Human-readable format

7. uptime – Show system uptime.

  • uptime

8. who – Display logged-in users.

  • who

4. Networking.

Networking in Linux is a vital component that allows systems to communicate and share resources over local or global networks. Linux provides powerful tools and commands to configure, monitor, and troubleshoot network connections. Commands like ifconfig and ip addr display and configure network interfaces. The ping command checks connectivity with other hosts, while traceroute shows the path packets take to reach a destination. netstat or ss display active network connections and listening ports. The nslookup and dig commands help query DNS information. To transfer files or connect remotely, Linux uses tools like scp, ssh, and ftp. The /etc/network/interfaces or NetworkManager tool manages network configurations. Firewall rules can be set using iptables or ufw for security. Overall, Linux networking provides flexibility, reliability, and control for both administrators and users.

1. ping – Test network connectivity.

  • ping google.com

2. ifconfig – Display network interfaces (use ip on newer systems).

  • ifconfig

3. netstat – Display network connections.

  • netstat -tuln # Show listening ports

4. ssh – Connect to a remote server.

  • ssh user@remote_host

5. scp – Securely copy files between hosts.

  • scp file.txt user@remote_host:/path/to/destination

6. wget – Download files from the web.

  • wget https://example.com/file.zip

7. curl – Transfer data from or to a server.

  • curl -O https://example.com/file.zip

8. nslookup – Query DNS records.

  • nslookup google.com

9. dig – DNS lookup utility.

  • dig google.com

10. traceroute – Trace the path packets take to a network host.

  • traceroute google.com

5. User and Group Management.

User and group management in Linux is essential for maintaining system security and organization. Every user has a unique account, and groups help manage permissions collectively. The useradd and adduser commands create new users, while passwd sets or changes passwords. To remove users, the userdel command is used. Groups are created with groupadd and managed using groupdel or usermod to add users to groups. User and group information is stored in files like /etc/passwd, /etc/shadow, and /etc/group. Permissions on files and directories are controlled by ownership and access rights, managed with chmod, chown, and chgrp. The id and who commands display information about logged-in users. Proper user and group management ensures that system resources are accessed securely and efficiently.

1. useradd – Add a user.

  • useradd username

2. usermod – Modify a user.

  • usermod -aG groupname username # Add user to a group

3. userdel – Delete a user.

  • userdel username

4. groupadd – Add a group.

  • groupadd groupname

5. groupmod – Modify a group.

  • groupmod -n newgroupname oldgroupname

6. groupdel – Delete a group.

  • groupdel groupname

7. passwd – Change user password.

  • passwd username

8. su – Switch user.

  • su username

9. sudo – Execute commands as a superuser.

  • sudo command

10. id – Display user and group information.

  • id username

Conclusion.

Learning the top 50 basic Linux commands is the foundation for becoming comfortable and confident with the Linux operating system. These commands help users efficiently navigate the file system, manage files and directories, monitor system performance, handle users and permissions, and perform networking tasks. Mastering them not only improves productivity but also builds a strong understanding of how Linux works internally. Regular practice of these commands enhances command-line proficiency, making complex tasks simpler and faster. As beginners progress, these basics serve as stepping stones to more advanced system administration and scripting skills. In short, a solid grasp of these Linux fundamentals opens the door to powerful system control and professional-level expertise.

shamitha
shamitha
Leave Comment
Share This Blog
Recent Posts
Get The Latest Updates

Subscribe To Our Newsletter

No spam, notifications only about our New Course updates.

Enroll Now
Enroll Now
Enquire Now