Let's continue our journey of Basic Linux Operation Part 2. If you haven't read the first part of Basic Linux Operations, refer to my 5th blog (Basic Linux Operations Pt. 1).
Commands in Linux
cat:
cat >> "<file_name>" #lets the user to create and write into a new file cat "<file_name>" #lets you to read the output of file
A new empty file with "demo.txt" and some text is written using the "(>>)" operator.
cp (Copy)
cp <"source_file"> <"destination_folder"> #copies the file from one path to another
The "demo.txt" file is copied from Home Directory to the Documents Directory.
**Note - In Linux, directories end with a forward slash(/)**
mv (Move):
mv <"source_file"> <"destination_folder"> #moves(cut) the file from one path to another mv <"file_name"> "<new_file_name>" #renames a file
The "demo.txt" file is moved from the Home Directory to the Documents Directory.
- echo:
echo "Hello World" #print statement
Hello World #output
man (Manual):
man <"any_command"> #gives the user manual of the command
Gives the user manual of the "ls" command.
top:
top #gives the running processes list
Root User in Linux
The root is the superuser account in Linux. It is a user account for administrative purposes and typically has the highest access rights on the system. Nothing is restricted or off-limits for root.
sudo su #goes into tho root user account with more privilages
Type "exit" to move out from the root user to the normal user.
Permissions in Linux
All three owners (user owner, group, others) in the Linux system have three types of permissions defined.
Read (r): Allows a user or group to view a file.
Write (w): Permits the user to write or modify a file or directory.
Execute (x): A user or group with execute permissions can execute a file or view a directory.
Format of a file:
position | character | ownership |
1 | - / d | denotes a file / denotes a directory |
2-4 | rw- | read, write permission for the owner |
5-7 | rw- | read, write permission for the group |
8-10 | r-- | read permission for other user |
Changing Permission of file using Numeric Code
Use the "chmod" command to give permission to a file
0 = No Permission
1 = Execute
2 = Write
4 = Read
chmod 700 <"file_name">
7 - Read + Write + Execute for Owner
0 - No Permission for Group
0 - No Permission for Other user
Only the owner has all the permission.
So, these all are the basic Linux commands or operations. Do practice them and explore more. โจ
The next Blog will soon be published, until then stay tuned. Happy Learning ๐