Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views2 pages

File Part2

this is about file handling part 2 in linux

Uploaded by

tambolikaif8080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

File Part2

this is about file handling part 2 in linux

Uploaded by

tambolikaif8080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux File and User Management - Beginner Guide

1. File Management Commands

These commands help you work with files and view their contents:

No. Command Description

1 ls List files and directories in the current folder. Like "see what's here."

2 cat filename Show all the content of a file at once.

3 less filename View file page by page (use arrow keys). Quit with q.

4 more filename Like less, shows one screen at a time. Quit with q.

5 head filename Show first 10 lines of the file.

6 tail filename Show last 10 lines of the file.

7 page filename View file page by page (similar to less). Not always pre-installed.

2. File & Directory Management (Part 2)

These are for copying, moving, searching files:

No. Command Description

1 cp source dest Copy a file from source to destination.

2 mv source dest Move or rename a file.

3 find /path -name name Find a file by name under a directory.

4 grep 'word' filename Search a word inside a file (shows matching lines).

5 cd foldername Change directory to the given folder.

6 diff file1 file2 Compare two files and show the differences.

7 sed 's/old/new/' file Find and replace text in a file. (Only shows result, doesn't change file)

8 chmod 755 file Change file permissions (who can read/write/execute).

9 chown user file Change the owner of the file.

10 file filename Shows the type of file (text, binary, etc).

3. User Management

There are 3 types of users in Linux:

1. Super (Root) User


 The most powerful user in Linux.

 Can do anything in the system.

 Home directory: /root

 Shell: /bin/bash

2. System User

 Created by software or applications (like Apache, SSH, FTP).

 Not for normal login.

 Home directory: /var/... or similar.

 Shell: /sbin/nologin

3. Normal User

 Created by root/superuser.

 Example: ec2-user in Amazon EC2 Linux.

 Home directory: /home/username

 Shell: /bin/bash

4. Login to Linux EC2 Instance

To log in to your EC2 instance:

ssh -i keypair.pem username@public-ip

Example:

ssh -i LinuxKeyPair.pem [email protected]

Use ubuntu instead of ec2-user if it's an Ubuntu instance.

You can practice these commands in your EC2 Linux instance or any Linux terminal.

Note: If any command gives an error like "command not found," it might not be installed. You can
install using:

sudo yum install packagename # on Amazon Linux

sudo apt install packagename # on Ubuntu

Let me know if you want practical step-by-step exercises to try each command!

You might also like