0% found this document useful (0 votes)
16 views8 pages

Linux Basic Commands 1748453726

Linux is a free and open-source operating system known for its security and multitasking capabilities, primarily utilizing a command-line interface. Key features include being open-source, supporting multiple users, and high security, with popular distributions like Ubuntu and RedHat. The document also covers essential Linux commands, user permissions, and scripting basics to help beginners navigate the system.

Uploaded by

ChakibMedchakib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views8 pages

Linux Basic Commands 1748453726

Linux is a free and open-source operating system known for its security and multitasking capabilities, primarily utilizing a command-line interface. Key features include being open-source, supporting multiple users, and high security, with popular distributions like Ubuntu and RedHat. The document also covers essential Linux commands, user permissions, and scripting basics to help beginners navigate the system.

Uploaded by

ChakibMedchakib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Linux Command Sheet – Beginner Friendly

What is Linux?

Linux is a free and open-source operating system known for its security, multitasking, and multi-user capabilities. It
primarily uses a command-line interface (CLI), making it a powerful tool for developers and system administrators.

What is an Operating System?

An Operating System (OS) acts as an interface between the hardware and the user. It enables applications like web browsers,
office software, and games to function properly by managing hardware resources.

Key Features of Linux

Feature Description

Open Source Freely available to use, modify, and distribute.

Multiuser & Multitasking Supports multiple users and running tasks at the same
time.

High Security Includes strong permission and access control


mechanisms.

Versatile Usage Found in servers, IoT devices, smartphones,


supercomputers, and more.

Popular Linux Distributions

RedHat
Ubuntu
Debian
CentOS
Fedora
OpenSUSE
Kali Linux
Amazon Linux
Rocky Linux

History of Linux

Released on September 17, 1991 by Linus Torvalds, a student from the University of Helsinki.
First version: Linux 0.01, written in C language.
Originally considered naming it "Freax", but it became "Linux".
Now powers a wide range of devices including supercomputers, phones, routers, and smart appliances.

Key Components

Kernel
The core of Linux that handles communication between hardware and software.

Shell

The interface between the user and the kernel. Two common types:

CLI (Command Line Interface) – Interacts via typed commands.


GUI (Graphical User Interface) – Interacts via visual elements.

Terminal

A text-based interface for entering commands.

User Permissions

Default user is often a limited user (e.g., ec2-user).


To switch to the root (admin) user:
sudo -i
To exit root and return to normal user:
exit

Categories of Linux Commands

System Commands
Hardware Commands
File Commands
Permission Commands
User Commands
Search Commands
Networking Commands

File Commands

Copy Command

Syntax: cp source destination


Example: cp file1 file2
Copies contents from file1 to file2 (overwrites file2 if it exists).

Safe Append Using cat

Syntax: cat file1 >> file2


Appends content of file1 to file2 without overwriting.

Move/Rename Command

Syntax: mv source destination


Example: mv file1 file2
Moves or renames a file.

Linux Command Categories and Examples


1. System Commands
Command Description

uname -a Displays system information

uptime Shows how long the system has been running

hostname Displays or sets the system hostname

reboot Reboots the system

shutdown Powers off the machine

2. Hardware commands

Command Description

lscpu Displays CPU architecture information

lsblk Lists information about block devices

free -h Shows memory usage in a human-readable format

df -h Displays disk space usage

lspci Lists PCI devices

lsusb Lists USB devices

3. File Commands
Command Description

ls Lists directory contents

pwd Prints current working directory

cd /path Changes the directory

touch file.txt Creates an empty file

mkdir foldername Creates a new directory

rm file.txt Deletes a file

rmdir foldername Deletes an empty directory

cp file1 file2 Copies file1 to file2

mv file1 file2 Moves or renames file1 to file2

cat file.txt Displays content of a file

4. Permission Commands

Command Description

chmod 755 file.sh Changes file permissions

chown user:group file Changes ownership of file

ls -l Lists files with permission details

5. User Commands
Command Description

whoami Shows the current logged-in user

id Displays user ID and group ID

adduser username Adds a new user

passwd username Changes password for a user

deluser username Deletes a user

su - username Switches to another user

6. Search Commands

Command Description

find / -name file.txt Searches for a file in the root directory

grep "text" file.txt Searches for a string inside a file

locate file.txt Finds file using an indexed database

7. Networking Commands

Command Description

ifconfig or ip a Shows IP address and network interfaces

ping google.com Tests network connectivity

netstat -tuln Displays active ports and listening sockets

curl Transfers data from or to a server

wget URL Downloads files from the internet


8. Process Management Commands

Command Description

ps aux Lists all running processes

top Real-time process monitoring

htop Interactive process viewer (if installed)

kill PID Terminates a process by PID

killall name Kills all processes by name

nice / renice Sets or changes process priority

9. Package Management
Depends on the distribution you're using (e.g., Ubuntu vs. RedHat)

Debian/Ubuntu Based (APT)

Command Description

apt update Updates package list

apt upgrade Installs available updates

apt install packagename Installs a new package

apt remove packagename Removes an installed package

RedHat/CentOS Based (YUM / DNF)


Command Description

yum update or dnf update Updates all packages

yum install packagename Installs a new package

yum remove packagename Removes an installed package

10. Scripting Basics (Bash)


Automate tasks using shell scripts

Hello World Script

bash

CopyEdit

#!/bin/bash

echo "Hello, Linux!"

Make Script Executable

bash

CopyEdit

chmod +x script.sh

./script.sh

Common Script Elements

Concept Syntax Example

Variables name="Linux"

Conditionals if [ $name == "Linux" ]; then

Loops for i in {1..5}; do echo $i; done

Functions myfunc() { echo "Hi"; }

You might also like