Discovering Linux: A Beginner's Guide to Starting with Linux Basics

Discovering Linux: A Beginner's Guide to Starting with Linux Basics

ยท

7 min read

In this blog, we are going to learn Linux basics, covering some basic concepts and commands to help you get started.

What is Linux?

Linux is an operating system that was first released in 1991 by Linus Torvalds. It is open-source, which means that anyone can use, modify, and distribute it. Linux is designed to be highly customizable, and there are thousands of software packages available for it.

Getting Started with Linux

To get started with Linux, you'll need to install a distribution. A distribution is a version of Linux that includes the operating system, desktop environment, and software applications. Some popular distributions include Ubuntu, Debian, and Fedora.

Linux Filesystem Hierarchy

One of the most important concepts to understand when working with Linux is the filesystem hierarchy. In Linux, everything is represented as a file, including hardware devices, directories, and files.

The root directory, denoted by the forward slash "/", is the top-level directory in the filesystem hierarchy. From the root directory, you can navigate to other directories and files.

Here are some of the most important directories in the Linux filesystem hierarchy:

  1. / : The root directory of the Linux filesystem hierarchy.

  2. /bin : This directory contains executable binary files that are essential for booting and running the system.

  3. /boot : This directory contains files needed for booting the system, including the kernel and boot loader.

  4. /dev : This directory contains device files, which allow user programs to interact with hardware devices.

  5. /etc : This directory contains system configuration files (like startup program, shutdown program scripts)

  6. /home : This directory contains home directories for regular users.

  7. /lib : This directory contains shared library files that are required by the system and user programs.

  8. /media : This directory contains mount points for removable media devices.

  9. /mnt : This directory contains mount points for temporary file systems.

  10. /opt : This directory is used for installing optional/third-party software packages.

  11. /proc : This directory contains virtual files that provide information about system processes and settings.

  12. /root : This directory is the home directory for the root user.

  13. /run : This directory contains files that are used to store runtime information.

  14. /sbin : This directory contains essential system binaries that are used for system administration by System maintenance purpose.

  15. /srv : This directory contains data for services provided by the system.

  16. /sys : This directory contains virtual files that provide information about system hardware.

  17. /tmp : This directory contains temporary files that are created by user programs and files are deleted once you reboot the system.

  18. /usr : This directory contains user binaries, libraries, documentation, and source-code for the system.

  19. /var : This directory contains variable data files, including logs, spool files, and temporary files. ( /var/logs, /var/lib, /var/mail, /var/tmp )

Linux Commands

Linux commands are text-based instructions used to interact with the Linux operating system. They are typed into a shell/terminal and typically consist of a command followed by one or more arguments or options. Linux commands can be used to perform various tasks, such as managing files and directories, installing software, and more.

Reference: ๐Ÿ‘‡

Please check this video if you need more details for the following commands

Below is the list of Linux commands you can start from basic, Intermediate and then to advanced commands.

Basic Commands:

  1. cd - Change the current working directory - Syntax: cd [directory]

  2. ls - List directory contents - Syntax: ls [options] [directory]

  3. pwd - Print the current working directory - Syntax: pwd

  4. mkdir - Create a new directory - Syntax: mkdir [options] [directory]

  5. rmdir - Remove an empty directory - Syntax: rmdir [options] [directory]

  6. touch - Create a new empty file or update the access and modification times of an existing file - Syntax: touch [options] [filename]

  7. cp - Copy files and directories - Syntax: cp [options] [source] [destination]

  8. mv - Move or rename files and directories - Syntax: mv [options] [source] [destination]

  9. rm - Remove files and directories - Syntax: rm [options] [file/directory]

  10. man - Display the manual page for a command - Syntax: man [command]

  11. whoami - Display the username of who is currently logged in - Syntax: whoami

    Intermediate Commands:

  12. chmod - Change the permissions of files and directories - Syntax: chmod [options] [mode] [file/directory]

  13. chown - Change the owner and group of files and directories - Syntax: chown [options] [owner][:group] [file/directory]

  14. sudo - Execute a command with administrative privileges - Syntax: sudo [command]

  15. su - Switch to another user account - Syntax: su [username]

  16. echo - Display a message or a variable value - Syntax: echo [options] [message/variable]

  17. nano - A simple text editor - Syntax: nano [filename]

  18. vi - A powerful text editor - Syntax: vi [filename]

  19. tail - Display the last few lines of a file - Syntax: tail [options] [file]

  20. head - Display the first few lines of a file - Syntax: head [options] [file]

  21. cat - Concatenate and display files - Syntax: cat [options] [file1] [file2] ...

  22. grep - Search for text in files - Syntax: grep [options] [pattern] [file]

  23. awk - Search and manipulate text in files - Syntax: awk [options] [program] [file]

  24. sed - Search and manipulate text in files - Syntax: sed [options] [commands] [file]

  25. cut - Cut out selected portions of a file - Syntax: cut [options] [file]

  26. sort - Sort lines of text in a file - Syntax: sort [options] [file]

  27. uniq - Remove duplicate lines from a file - Syntax: uniq [options] [file]

  28. diff - Display the differences between two files - Syntax: diff [options] [file1] [file2]

  29. patch - Apply changes to a file - Syntax: patch [options] [file]

  30. ps - Display information about running processes - Syntax: ps [options]

  31. top - Display real-time system resource usage - Syntax: top

    Advanced Commands:

  32. tar - Create, compress, and extract tar archives - Syntax: tar [options] [archive_name] [file/directory]

  33. gzip - Compress files using the gzip algorithm - Syntax: gzip [options] [file]

  34. gunzip - Decompress files compressed with gzip - Syntax: gunzip [options] [file]

  35. locate - Search for files and directories in a database - Syntax: locate [options] [pattern]

  36. find - Search for files and directories in a directory hierarchy - Syntax: find [options] [path] [expression]

  37. tee - Redirect output to a file and standard output - Syntax: tee [options] [file]

  38. scp - Copy files securely over SSH - Syntax: scp [options] [source] [destination]

  39. ssh - Connect to a remote host securely over SSH - Syntax: ssh [options] [user@]hostname

  40. rsync - Synchronize files and directories between two systems - Syntax: rsync [options] [source] [destination]

  41. ftp - Transfer files over the File Transfer Protocol - Syntax: ftp [options] [hostname]

  42. sftp - Transfer files securely over SSH - Syntax: sftp [options] [user@]hostname

  43. mount - Attach a filesystem to the system's directory tree - Syntax: mount [options] [device] [mountpoint]

  44. umount - Detach a mounted filesystem - Syntax: umount [options] [mountpoint]

  45. df - Display filesystem disk space usage - Syntax: df [options]

  46. fdisk - Partition and format disk drives - Syntax: fdisk [options] [device]

  47. mkfs - Create a filesystem on a partition - Syntax: mkfs [options] [device]

  48. fsck - Check and repair a filesystem - Syntax: fsck [options] [device]

  49. wget - Download files from the internet - Syntax: wget [options] [URL]

  50. curl - Transfer data from or to a server - Syntax: curl [options] [URL]

  51. kill - Terminate a process - Syntax: kill [options] [PID]

Summary:

Today we covered Linux basics, including the Linux filesystem hierarchy and a list of essential commands to get started. Remember, mastering Linux requires practice, so take the time to familiarize yourself with these commands and keep practicing.

I hope this blog has been informative and helpful to you. Stay tuned for my next blog on "Linux Tools and Utilities". I will keep sharing my learnings and knowledge here with you.

Let's learn together! I appreciate any comments or suggestions you may have to improve my Linux blog.

Thank you,

Chaitannyaa Gaikwad

Did you find this article valuable?

Support Chaitannyaa Gaikwad by becoming a sponsor. Any amount is appreciated!

ย