0% found this document useful (0 votes)
23 views

Micro - Project - Linux Milan Pratik Prasen

Uploaded by

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

Micro - Project - Linux Milan Pratik Prasen

Uploaded by

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

Micro Project

On
FILE MANAGEMENT

By
SUTHAR PRASEN R (236040316094) , THAKOR MILAN
(236040316097) , VANKAR PRATIK
(236040316101)Enrollment No: 236040316094 , 236040316097 ,
236040316101

A Micro Project in LINUX OPREATING SYSTEM (4331602)


Submitted to

Information Technology Department


B & B Institute of Technology, Vallabh Vidyanagar
Certificate

This is to certify that SUTHAR PRASEN R (236040316094) ,


THAKOR MILAN (236040316097) , VANKAR PRATIK
(236040316101) have/has successfully completed the Micro
project on FILE MANAGEMENT SYSTEM for the subject
Data Structure with Python (4331601) under my guidance
and supervision.

Date:22/10/24
Place: B&B INSTITUE OF TECHNOLOGY , VV NAGAR
ANNAD

Signature of Subject Coordinator:


NISHI PATEL
Acknowledgement
October 2024
Table of Contents

1. Introduction
1.1 File Management in Linux
1.2 File listing
1.2.1 Creating files
1.2.2 Displaying file contents
1.3 ...
2. Softwares for [ linux terminal ]
2.1 Moving a File
2.2 renaming a file
2.3 deleting a file
1. Introduction

1.1 File Management in Linux


In Linux, most of the operations are performed on files. And to handle these
files Linux has directories also known as folders which are maintained in a
tree-like structure. Though, these directories are also a type of file
themselves. Linux has 3 types of files:
1. Regular Files: It is the common file type in Linux. it includes files like –
text files, images, binary files, etc. Such files can be created using the
touch command. They consist of the majority of files in the Linux/UNIX
system. The regular file contains ASCII or Human Readable text,
executable program binaries, program data and much more.
2. Directories: Windows call these directories as folders. These are the
files that store the list of file names and the related information. The root
directory(/) is the base of the system, /home/ is the default location for
user’s home directories, /bin for Essential User Binaries, /boot – Static
Boot Files, etc. We could create new directories with mkdir command.
3. Special Files: Represents a real physical device such as a printer which
is used for IO operations. Device or special files are used for device
Input/Output(I/O) on UNIX and Linux systems. You can see them in a
file system like an ordinary directory or file.
In Unix systems, there are two types of special files for each device, i.e.
character special files and block special files. For more details, read the
article Unix file system.

1.2 Files Listing

To perform Files listings or to list files and directories ls command is used


$ls
All your files and directories in the current directory would be listed and
each type of file would be displayed with a different color. Like in the
output directories are displayed with dark blue color.
$ls -l

It returns the detailed listing of the files and directories in the current
directory. The command gives os the owner of the file and even which file
could be managed by which user or group and which user/group has the
right to access or execute which file.

1.3 Creating Files

touch command can be used to create a new file. It will create and open a
new blank file if the file with a filename does not exist. And in case the file
already exists then the file will not be affected.
$touch filename
1.3 Displaying File Contents

cat command can be used to display the contents of a file. This command
will display the contents of the ‘filename’ file. And if the output is very
large then we could use more or less to fit the output on the terminal screen
otherwise the content of the whole file is displayed at once.
$cat filename

1.4 Copying a File

cp command could be used to create the copy of a file. It will create the new
file in destination with the same name and content as that of the file
‘filename’.
$cp source/filename destination/

1.5. Moving a File

mv command could be used to move a file from source to destination. It will


remove the file filename from the source folder and would be creating a file
with the same name and content in the destination folder.
$mv source/filename destination/

1.6 Renaming a File

mv command could be used to rename a file. It will rename the filename to


new_filename or in other words, it will remove the filename file and would
be creating a new file with the new_filename with the same content and
name as that of the filename file.
$mv filename new_filename

1.7 Deleting a File

rm command could be used to delete a file. It will remove the filename file
from the directory.
$rm filename

Unlock the power of Linux with our Online Linux Course with
Certification! Whether a beginner or an experienced professional, this
course is designed to help you master Linux, the backbone of modern
computing. Dive into comprehensive modules covering everything
from basic commands to advanced system administration. With hands-
on projects and real-world examples, you'll gain the skills to manage
Linux environments efficiently and confidently. Plus, earn a certification
that showcases your expertise to potential employers.
Ready to become a Linux pro? Enroll now and take your tech career to the
next level!
File management in Linux revolves around organizing, accessing, and
manipulating files and directories using various command-line tools
and utilities. Here's a summary of key concepts and commands:

### **1. File System Structure**

- **Root directory (`/`)**: The top-level directory in Linux, from which


all other directories branch out.

- **Home directory (`/home`)**: Contains personal directories for each


user (e.g., `/home/user`).

- **Special directories**:

- `.`: Current directory

- `..`: Parent directory

- `/`: Root directory

### **2. Common File Management Commands**

#### **Navigating Directories**

- `pwd`: Print working directory, shows the current directory.

- `ls`: List directory contents.

- `ls -l`: Long format with file details (permissions, ownership, etc.).

- `ls -a`: List all files, including hidden files.

- `cd <directory>`: Change directory.

- `cd ..`: Go up one level in the directory structure.

#### **Creating and Deleting Files/Directories**

- `touch <file>`: Create an empty file or update the timestamp.


- `mkdir <directory>`: Create a new directory.

- `mkdir -p <dir/subdir>`: Create nested directories.

- `rm <file>`: Remove a file.

- `rm -r <directory>`: Remove a directory and its contents recursively.

- `rm -f <file>`: Forcefully remove a file without confirmation.

- `rmdir <directory>`: Remove an empty directory.

#### **Copying and Moving Files**

- `cp <source> <destination>`: Copy files or directories.

- `cp -r <source> <destination>`: Copy directories recursively.

- `mv <source> <destination>`: Move or rename files and directories.

#### **Viewing File Contents**

- `cat <file>`: Display the entire content of a file.

- `less <file>`: View file contents page by page.

- `head <file>`: View the first few lines of a file (default is 10 lines).

- `tail <file>`: View the last few lines of a file.

#### **Searching and Finding Files**

- `find <path> -name <filename>`: Search for files by name within a


specified directory.

- `locate <filename>`: Quickly find files by name (requires `locate`


database to be updated with `updatedb`).

- `grep <pattern> <file>`: Search for a pattern or string inside a file.


### **3. Permissions and Ownership**

- **Permissions**: Each file/directory has permissions for the owner,


group, and others (e.g., `rwxr-xr--`).

- `r`: Read, `w`: Write, `x`: Execute.

- `chmod <permissions> <file>`: Change file permissions.

- `chmod 755 <file>`: Set read, write, execute for the owner; read,
execute for group and others.

- `chown <user>:<group> <file>`: Change file ownership.

### **4. Archiving and Compression**

- `tar -cvf <archive.tar> <files>`: Create a tar archive.

- `tar -xvf <archive.tar>`: Extract a tar archive.

- `gzip <file>`: Compress a file using gzip.

- `gunzip <file.gz>`: Decompress a gzip file.

### **5. Disk Usage and Space**

- `df -h`: Display available disk space on all mounted filesystems.

- `du -h <directory>`: Display disk usage of a directory and its contents.

These commands are foundational for managing files efficiently in


Linux, making it a powerful environment for organizing and working
with large amounts of data.
Linux is based on the following key concepts and components:

### 1. **Unix Philosophy**

Linux is based on the design principles of **Unix**, an operating


system developed in the 1970s. The Unix philosophy emphasizes
simplicity, modularity, and the idea that programs should:

- **Do one thing well**: Each program is designed to perform a


specific task effectively.

- **Work together**: Programs are designed to interact through text


streams (standard input and output).

- **Use plain text for data**: Text files are preferred as a universal
format for input, output, and configuration.

### 2. **Linux Kernel**

The **Linux kernel** is the core of the Linux operating system. It


was initially developed by Linus Torvalds in 1991. The kernel manages
the hardware resources of the system and provides essential services
like:

- **Process management**: Controls the execution of processes


(programs).

- **Memory management**: Manages system memory and allocates


memory for processes.

- **Device drivers**: Provides interfaces for interacting with


hardware devices.

- **File system management**: Organizes how data is stored and


retrieved on disk.

- **Networking**: Manages network connections and data


transmission between systems.

### 3. **Open Source and GPL License**


Linux is built under the **GNU General Public License (GPL)**,
which means:

- The source code is open and available for anyone to view, modify,
and distribute.

- Contributions from a global community of developers improve and


maintain the Linux ecosystem.

- Modifications to the code must also be distributed under the same


open license.

### 4. **GNU Utilities and Tools**

Linux is often paired with **GNU** (GNU's Not Unix!) utilities,


which provide many of the essential command-line tools and programs
used in Linux:

- **Shells** (like `bash`): For interacting with the operating system


through command-line interfaces.

- **Core utilities**: Tools for file management (e.g., `cp`, `ls`, `rm`),
text processing (e.g., `grep`, `sed`), and system monitoring (e.g., `top`,
`ps`).

### 5. **File System Hierarchy**

Linux follows a standardized **File System Hierarchy** that defines


where files should be located:

- **/ (root)**: The root of the file system hierarchy.

- **/home**: Home directories for users.

- **/bin, /sbin**: Essential system binaries and executables.

- **/etc**: System-wide configuration files.

- **/var**: Variable files, including logs and temporary data.

- **/dev**: Device files (e.g., disks, USB devices).

- **/proc**: Virtual file system for system and process information.


### 6. **Package Management**

Linux distributions use package managers to install, update, and


remove software. Some popular package managers include:

- **APT** (`apt-get`, `apt`): Used in Debian-based distributions (e.g.,


Ubuntu).

- **YUM/DNF**: Used in Red Hat-based distributions (e.g., Fedora,


CentOS).

- **Pacman**: Used in Arch Linux.

### 7. **Modularity**

Linux is designed to be modular, meaning that users can customize


their systems by installing only the software they need. The kernel,
desktop environments, command-line utilities, and application
programs can be selected and installed independently.

### 8. **Distributions**

Linux is not a single operating system but a collection of distributions


(or "distros"), each with different features, package management
systems, and software sets. Popular Linux distributions include:

- **Ubuntu**: User-friendly, based on Debian.

- **Fedora**: Cutting-edge features, backed by Red Hat.

- **Arch Linux**: Minimalist, focuses on customization.

- **CentOS**: Enterprise-grade, stable, and used for servers.

In essence, Linux is built upon the foundation of Unix, enriched by


open-source collaboration, the GNU ecosystem, and a highly modular
and customizable environment.
Conclusion :
In this beginner-friendly guide to Linux navigation and file management, we have
covered essential concepts and commands that will help you become proficient in
working with the Linux file system.
References
[1] https://abcd.com

[2] https:// https://linux-kernel-labs.github.io/refs/heads/master/lectures/fs.html

[3] https://www.jaroeducation.com/blog/10-standard-linux-commands-for-file-
management/

You might also like