Articles

Linux Command Line Basics

Linux Command Line Basics

Linux Operating System

20/09/2023 15:09

Serhat P.

10 min. reading

Linux, as a free and open-source operating system, is preferred by many users and organizations worldwide. The Linux command line is a tool that allows you to interact more effectively with the system. In this article, we will examine the basics of the Linux command line and the most frequently used commands in detail.

Contents

  1. Linux Terminal and Command Line
  2. File and Directory Management Commands
  3. System Information and Monitoring Commands
  4. Network Management Commands
  5. Software Management Commands
  6. User and Group Management
  7. Disk Management
  8. Scheduled Tasks (Cron Jobs)
  9. Managing Log Files

1. Linux Terminal and Command Line

The heart of the Linux operating system, the terminal provides users with a text-based interface.

Basic Commands

  • whoami: Shows which user is currently logged in.
  • history: Displays a list of previously used commands.
  • echo: A command to print to the screen, generally used to print variables and strings.
  • exit: Closes the current session.

2. File and Directory Management Commands

Management of files and directories is one of the fundamentals of Linux.

File Operations

  • cat: Displays the content of files.
  • head: Displays a certain number of lines from the beginning of a file.
  • tail: Displays a certain number of lines from the end of a file.
  • less: Displays file content page by page.
  • chmod: Changes file permissions.
  • chown: Changes file ownership.

Directory Operations

  • find: Searches for files and directories.
  • grep: Scans files for a specific regular expression or string.
  • tar: Archives files or extracts archived files.
  • zip & unzip: Compresses files or extracts compressed files.

3. System Information and Monitoring Commands

Some commands used to display and monitor system information include:

  • uptime: Shows how long the system has been running.
  • w: Shows who is logged in.
  • who: Shows the users currently logged in.
  • vmstat: Provides information about memory, processor, disk I/O, etc.
  • iostat: Displays system input/output statistics.
  • mpstat: Displays CPU usage statistics.

4. Network Management Commands

The basic commands used to manage and monitor network resources include:

  • netstat: Shows network connections, routing tables, etc.
  • arp: Views or changes the ARP cache.
  • iwconfig: Displays and sets wireless network parameters.
  • curl: Used for operations with URLs.
  • wget: Downloads files from the internet.

5. Software Management Commands

Some commands you can use for software management in Linux include:

  • dpkg: Manages Debian packages.
  • rpm: Manages RPM packages.
  • yum: Package manager in Red Hat/CentOS.
  • apt: Package manager in Debian/Ubuntu.

6. User and Group Management

User and group management in Linux is essential for a secure and organized system.

  • useradd: Adds a new user.
  • userdel: Deletes a user.
  • groupadd: Adds a new group.
  • groupdel: Deletes a group.
  • passwd: Changes user passwords.
  • chage: Manages user password expiration times.

7. Disk Management

Some commands you can use for disk management in Linux include:

  • fdisk: Manages disk partitions.
  • du: Shows disk usage.
  • dd: Copies disks and partitions.
  • fsck: Checks and repairs the file system.
  • mkfs: Creates a new file system.

8. Scheduled Tasks (Cron Jobs)

Scheduled tasks allow for specific commands to be automatically executed at specific times.

  • cron: Daemon service for scheduled tasks.
  • crontab: Edits the scheduled task table.
  • anacron: Runs tasks that couldn't be run while the system was shut down at a later time.

9. Managing Log Files

Logs, which record events occurring in the system, are indispensable for troubleshooting and performance monitoring.

  • dmesg: Displays kernel log messages.
  • syslog: Manages system logs.
  • logrotate: Rotates and archives log files.

Conclusion

The Linux command line allows you to interact deeply with the operating system. The basic commands listed above are a starting point for beginners in the Linux operating system. You can start learning these commands through practice and delve deeper into the world of Linux. We recommend that you work on these commands and perform applications before moving on to more advanced topics. We hope this guide helps you on your Linux journey.

MakdosTech Footer Logo

All Rights Reserved 2024 - Makdos Tech

Sharing of articles without permission or attribution is prohibited.