Table of contents
Table of Contents
What is Linux?
Architecture of Linux
Basic commands of Linux
what are Linux commands to,
Check your present working directory.
List all the files or directories including hidden files.
Create a nested directory A/B/C/D/E.
What is Linux?
Linux is an operating system, which is based on Linux Kernel. It is an open-source operating system where it can run on different hardware platforms. It provides a free and low-cost operating system for users. It is a user-friendly environment where they can easily modify and create variations in the source code.
Architecture of Linux
Kernel: It is the core component of Linux, it acts as an interface between software and hardware.
Shell: It acts as an interface between the user and the Kernel.
GUI: It stands for Graphic User Interface, which is another way for the user to interact with the system. But it is unlike images, buttons, and text boxes for interaction.
System Utilities: These are the software functions that allow users to manage the computer.
Application Programs: A set of functions designed to perform a set of tasks.
Basic commands of Linux:
Basic and most commonly used commands.
Is: Displays information about files in the current directory.
pwd: Displays the current working directory.
mkdir: Creates a directory.
cd: To navigate between different folders.
cp: Moves files from one directory to another.
mv: Rename and Replace the files
rm: Delete files
uname: Command to get basic information about the OS
locate: Find a file in the database.
touch: Create empty files
ln: Create shortcuts to other files
cat: Display file contents on terminal
history: The system will list up to previously executed commands, allowing you to reuse them without re-entering.
man: Access manual for all Linux commands
grep: Search for a specific string in an output
echo: Display active processes on the terminal
wget: download files from the internet
whoami: Create or update passwords for existing users
ping: Use ping to check your connection to a server.
chmod: To make a file executable and to change the permissions granted to it in Linux.
du: Use du to know the disk usage of a file in your system.
tar: To create and extract archive files. An archive file is a compressed file that contains one or more files bundled together for more accessible storage and portability.
Check your present working directory
The command used to check the directory you are currently at - pwd
pwd stands for Print Working Directory. It writes the complete path name of the working directory to standard output in operating systems.
cd ~ / cd: This navigates to the home directory.
cd - : To change back to the previous working directory, pass the dash (-
) character as an argument to the cd command.
cd . . : which is used to move to the parent directory of the current directory, or the directory one level up from the current directory. “..” represents the parent directory.
cd . . /. . : This command changes the directory to two previous directories up from the directory you are currently at.
List all the files or directories including hidden files:
ls is a Linux shell command that lists directory contents of files and directories. It provides valuable information about files, directories, and their attributes.
Syntax of ls
command in Linux
ls [option ] [file/directory]
ls -a: This shows all hidden files in the directory you are in
ls-l: It is a long format that displays detailed information about files and directories.
Field explanation:
drwxrwxr-x 2 ec2-user ec2-user 6 Jul 19 06:51 dev3
Field 1 – File Permissions: Every 3 characters specify read, write and execute permissions for user(root), group and others respectively in order.
Field 2 – Number of links: This specifies the number of links for that file. In the above line, 2 indicates two links to this file.
Field 3 – Owner: specifies the owner of the file. In the above line, this file is owned by username ‘ec2-user’.
Field 4 – Group: specifies the group of the file. In the above line, this file belongs to ’ec2-user' group.
Field 5 – Size: specifies the size of a file in bytes. In this example, ‘6’ indicates the file size in bytes.
Field 6 – Last modified date and time: specifies the date and time of the last modification of the file. In this example, ‘Jul 19 06:51' specifies the last modification time of the file.
Field 7 – File name: The last field is the name of the file. In this example, the file name is dev3.
ls -i:
which displays the index number (inode) of each file and directory.
ls -d */:
List directories themselves, rather than their contents.
Create a nested directory A/B/C/D/E.
mkdir: This command allows the user to create directories. This command can create multiple directories at once as well as set the permissions for the directories.
Syntax:
mkdir [options ] [directory name........]
example: mkdir devops
mkdir . : This command creates hidden directories
mkdir A B C D: To create multiple directories
mkdir -p a/b/c/d: To create nested directories.
Thank you, This is my understanding about some of Linux commands. Hope you find this helpful.
Thank you Shubham Londhe !!
#TrainwithShubham #DevOps #DevOpsJourney #90Daysofchallenge #Linux #Linuxcommands