Home / Linux / Introduction to Linux

Introduction to Linux

Introduction to Linux

What is Linux?

Linux is a type of operating system. It's a bit like Windows or MacOS, but instead of being made by a big company, it's open-source software that anyone can use and modify.

Setting up a Linux computer

If you're brand new to Linux, the first thing you'll need to do is set up your computer with a Linux operating system. This typically involves:

  1. Downloading a Linux distribution from a website like www.linuxdistro.com.
  2. Creating a bootable USB drive using software like Rufus or Balena Etcher.
  3. Inserting the USB drive into your computer and restarting it to boot from the USB drive.

The Terminal

Linux uses a terminal window to interact with the operating system. This is where you'll run commands and view files.

To open the terminal, look for an icon labeled "Terminal" or something similar on your desktop or start menu.

Basic Commands

  • ls: List files in the current directory.
  • cd: Change directories (folders).
  • pwd: Print working directory (shows where you are).
  • mkdir: Make a new directory.
  • rm: Remove a file or directory.
  • cp: Copy a file or directory.
  • mv: Move a file or directory.
  • cat: Display the contents of a file.

Example usage:

# List files in current directory
ls

# Change to a different directory (e.g., Documents)
cd /home/user/Documents

# Create a new directory called "Projects"
mkdir Projects

# Copy a file from one directory to another
cp /home/user/Documents/report.txt /home/user/Projects/

# Move the copied file and rename it
mv /home/user/Projects/report.txt /home/user/Projects/final_report.txt

# Display contents of a file
cat /home/user/Projects/final_report.txt

Files and Directories

In Linux, files are stored in directories. The root directory is /, and all other directories branch off from here.

Creating files

To create a new file, you can use a text editor like nano or vim.

# Create a new file called "example.txt"
nano example.txt

This will open the file in the nano text editor. You can type into it and save your changes by pressing Ctrl+O, then exiting with Ctrl+X.

Packages and Software Management

Linux comes with its own package manager to install, update, and remove software.

Basic Commands

  • apt-get update: Update package lists.
  • apt-get upgrade: Upgrade all installed packages.
  • apt-get install <package_name>: Install a package.
  • apt-get remove <package_name>: Remove a package.

Example usage:

# Update package lists
sudo apt-get update

# Upgrade all packages
sudo apt-get upgrade

# Install a new package (e.g., git)
sudo apt-get install git

# Remove a package (e.g., git)
sudo apt-get remove git

Conclusion

This is just the tip of the iceberg when it comes to Linux. There's a lot more you can do, such as configuring your system, using command-line tools, and exploring various distributions.

If you're interested in learning more, I recommend checking out some online resources like the official Ubuntu documentation or the Linux Mint forums.