Basic Linux Commands

Introduction

This article is an introduction to many Linux command line commands. Each command has one or more arguments which I did not include.

This is not a comprehensive list, however this list will get you well on your way.

Here are some fundamental Linux commands that are essential for everyday use:

File and Directory Management:

    • ls – List directory contents
    • cd – Change directory
    • pwd – Print working directory (shows the current directory)
    • mkdir – Make a new directory
    • rmdir – Remove an empty directory
    • rm – Remove files or directories
    • cp – Copy files or directories
    • mv – Move or rename files or directories
    • touch – Create an empty file or update the timestamp of a file

File Viewing and Editing:

    • cat – Display file contents
    • more / less – View file contents page by page
    • head – Display the first few lines of a file
    • tail – Display the last few lines of a file

File Permissions and Ownership:

    • chmod – Change file permissions
    • chown – Change file owner and group
    • chgrp – Change the group ownership of a file

System Information:

    • df – Display disk space usage
    • du – Show disk usage of files and directories
    • top – Display system processes
    • ps – Show running processes
    • free – Show memory usage
    • uptime – Show how long the system has been running
    • uname – Show system information

Package Management (Debian-based systems like Ubuntu):

    • apt-get – Package management tool

Searching:

    • find – Search for files in a directory hierarchy
    • grep – Search for text patterns within files

Networking:

    • ping – Test network connectivity
    • ifconfig (or ip a) – Show network interface configuration
    • netstat – Show network connections
    • scp – Secure copy (copy files over SSH)

Archive and Compression:

    • tar – Create and extract tar archives
    • zip / unzip – Compress or decompress files

Other Useful Commands:

    • sudo – Execute a command as a superuser
    • man – Show the manual for a command
    • history – Show the history of previously executed commands
    • alias – Create custom command shortcuts

Conclusion

In this article we cover a lot of the Linux command line commands. This may not be a comprehensive list of Linux command, however the contents of this article will get you well on your way to managing Linux from the command line.