Basics of Linux

Basics of Linux

Linux - 1

·

4 min read

Linux is an open-source operating system (OS). An operating system is software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

The command line is your direct access to a computer. It’s where you ask the software to perform hardware actions that point-and-click graphical user interfaces (GUIs) simply can’t ask.

Filesystem hierarchy standard describes directory structure and its content in Unix and Unix-like operating systems. It explains where files and directories should be located and what they should contain.

Directory

Description

/

The directory is called “root.” It is the starting point for the file system hierarchy.

/boot

It contains all the boot-related information files and folders such as conf, grub, etc...

/etc

System configuration files

/proc

It is a virtual and pseudo-file system to contains info about the running processes with a specific process ID or PID.

/dev

It is the location of the device files such as dev/sda1, dev/sda2, etc.

/home

Home directories

/root

Root Home Directory

/var

Variable data most notably log files.

/usr

User related programs

/run

Application State Files

/tmp

Temporary space typically cleared on reboot

/mnt

Temporary Mount Points

/opt

Optional or third-party software

/bin

Binaries and other executable programs

/sbin

System Administration Binaries

Some of the basic Linux commands:

ls

Lists files and directories within a system

ls [path]

pwd

Path of your current working directory

cd [path]

cat

Lists combine and write file content to the standard output

cat [filenme]

mv

To move and rename files and directories

mv [filename] [path/filename]

mkdir

To create one or multiple directories at once and set permissions for each of them

mkdir [option] directory_name

rm

Used to delete files within a directory

rm [filename]

touch

Allows you to create an empty file or generate and modify a timestamp in the Linux command line

touch [path/filename]

grep

Find a word by searching through all the texts in a specific file

grep [pattern] [filename]

df

Report the system’s disk space usage shown in percentage and kilobyte (KB)

df [options] [file]

du

Check how much space a file or a directory takes up

du [path]

head

Allows you to view the first ten lines of a text

head [option] [file]

tail

Displays the last ten lines of a file

tail [option] [file]

diff

Compares two contents of a file line by line

diff [option] file1 file2

tar

Archives multiple files into a TAR file

tar [options] [archive_file] [file/directory to be archived]

chmod

The command that modifies a file or directory’s read write and/or execute permissions

chmod [option] [permission] [file_name]

chown

Change ownership permission

chown [ownername: filename]

top

Display all the running processes and a dynamic real-time view of the current system

top

su

Allows you to run a program as a different user

su [options] [username [argument]]

ps

Produces a snapshot of all running processes in your system

ps [option]

ssh

Secure Shell command

ssh [ip address]

ufw

Firewall command

ufw [services]

traceroute

Trace all the network hops to reach the destination

traceroute [ip address]

kill

Kill active processes by process ID

kill [id]

nano/vi

Editor

useradd and user mod

Add a new user or change existing users data

useradd [username]

passwd

Create or update passwords for existing users

passwd [username]

ifconfig

Display network interfaces and IP addresses

ifconfig

Thank you for reading...!!!!