DevOps Learning Notes
2 Followers
In this lecture you are learning LINUX basic commands and Linux Directory Structure:
In Linux, data will stored into files and files are organized into directories. Files and Directories are organized into hierarchical format with parent and child relationship to the directories, called the file system.
Directory Structure:
Linux uses a hierarchical directory structure, with root (/) at the base of all other directories, which is called as root directory.
A LINUX directory is a collection of files and directories with below properties:

File Management:
In LINUX there are three basic types of files:
Directory Management:
Home Directory:
It’s the default directory where User is placed in once User logged in to the Linux server. User get complete access to their Home Directory as the user is owner of Home Directory.
Absolute/Relative Path:
Directories are arranged in a hierarchy with root (/) at the top. Any file placed in a directory is located by its path name.
Pathname are separated by a / and pathname started with / is called as Absolute Path and the path starting with . Or .. is called as Relative Path.
Relative Paths are always start with . or .. Referencing the path from current or parent directory.
Linux Users:
In Linux, User is the one who uses the system to perform any tasks. Linux has three type of users to access the system.
Linux Basic Commands:
Linux command accepts arguments and flags to process your request. Note that arguments and flags are not mandate and you provide these based on the requirement.
Linux arguments an argument, also called command line argument, can be defined as input given to command line to process that input with help of given command. The argument can be a file or directory.
Providing flag to the command changes the execution behaviour and your output changes when using different flags .
Examples: mkdir <dir_name as argument>
ls –l -> Here –l is the flag
Below are the some basics commands with examples that you must know
whoami: Check who currently logged in to the Linux server
[edwiki@@ip-172-31-53-92 ]$whoami
ec2-user
[edwiki@@ip-172-31-53-92 ]$
date: Check current timestamp with server timezone
[edwiki@@ip-172-31-53-92 ]$date
Tue Jan 31 06:24:29 UTC 2023
[edwiki@@ip-172-31-53-92 ]$
mkdir: Create directory
[edwiki@@ip-172-31-53-92 ]$mkdir dir1
touch: create zero size regular file
[edwiki@@ip-172-31-53-92 ]$touch f1
rmdir: remove directory
[edwiki@@ip-172-31-53-92 ]$rmdir dir1
rm: remove files
[edwiki@@ip-172-31-53-92 ]$rm f1
ls: list files and directories
[edwiki@@ip-172-31-53-92 ]$ls
dir1 f1
[edwiki@@ip-172-31-53-92 ]$
[edwiki@@ip-172-31-53-92 ]$ls -l
total 0
drwxrwxr-x 2 ec2-user ec2-user 6 Jan 31 06:25 dir1
-rw-rw-r-- 1 ec2-user ec2-user 0 Jan 31 06:25 f1
[edwiki@@ip-172-31-53-92 ]$
NOTE: Here line starts with ‘d’ states that this is directory – dir1 and starts with ‘-‘ states that this is file – f1
pwd: Shows your present working directory
[edwiki@@ip-172-31-53-92 ]$pwd
/home/ec2-user
[edwiki@@ip-172-31-53-92 ]$
cd: To change the present working directory path
[root@ip-172-31-53-92 ~]# pwd
/root
[root@ip-172-31-53-92 ~]# cd /var
[root@ip-172-31-53-92 var]# pwd
/var
[root@ip-172-31-53-92 var]#
sudo su -: Switch to root user
[edwiki@@ip-172-31-53-92 ]$sudo su -
[root@ip-172-31-53-92 ~]# whoami
root
[root@ip-172-31-53-92 ~]#