Basics of Linux Terminal Commands



 

What is Linux?

Linux is one of the most used operating system for programmers.  Most of them prefer Linux over other operating systems due to its versatility, power, security, and speed. Linux comprises several different pieces

·         Bootloader

·         Kernel

·         Init system

·         Daemons

·         Graphical server

·         Desktop environment

·         Application

We will basically focus on Kernel here

What is Kernel?

This is the one piece of the whole that is actually called Linux. The kernel is the core of the system and manages the CPU, memory, and peripheral devices. The kernel is the lowest level of the OS.

 

What is Linux Terminal/Console?

The Linux console is a system console internal to the Linux kernel. The Linux console provides a way for the kernel and other processes to send text output to the user and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor.

 

BASIC LINUX COMMANDS

COMMAND

PURPOSE

Ctrl + l / clear

Clears the screen

uname

Gives the environment name of the system

q

quit

man

Gives the manual of a specific command

uptime

Gives uptime details of the system (active time)

cd

change directory

cd..

one directory back

cd

Shift to the parent directory

pwd

Gives the present working directory

ls

List of files

mkdir

Make a directory within the present location

ls – l / ll

A long list of files in the directory

alias

Creates aliases

ls -a

Listing all the files including the hidden files

date

Display a date

cal

Calculator

w

Users using the system

whoami

The current logged in user

whereis

Gives the location of the utility/program in the current directory

rm

Remove

rm -r

Recursively delete

touch

Creates a file

history

Shows the commands applied before on a file/folder

cat

The command ran (kinda like history)

head

The head of the command

 

PERMISSIONS

There are basically three types of permissions in Linux

1.       Read – permission to view content

2.       Write – permission to modify/add

3.       Execute – permission to run a program

These permissions have number values to represent them

·         Read(r) – 4

·         Write(w) – 2

·         Execute(x) – 1

Sample permission string

-rwx -r-x -r-x

This string is divided into three parts

1.       (-) or (-D) for a file or directory

2.       (rwx) for a read, write, and execute permission for the creator

3.       (r-x) for the read and execute permission for the group of users(sort of)

4.       (r-x) for the read + execute permission for everyone logged into the system

 

Change the permission

Command - Chmod 775 filename

·         7 = rwx 4+2+1

·         5 = rx 4+1

·         5 = rx 4+1 filename

We just gave read, write and execute to the creator then read, execute to the group and everyone

 

 

 

Comments