2. Creating and Managing Files and Directories
• To create a new directory in Linux, use the mkdir command followed
by the directory name.
mkdir documents
• To create a new file, you can use the touch command.
touch file.txt
• To list files and directories in the current directory, use the ls
command.
ls
3. • To list files and directories in a specific directory, provide the path as an
argument to ls.
ls /path/to/directory
4. Copying Files and Directories
• To copy a file, use the cp command followed by the source file and
destination.
cp file.txt /path/to/destination/
• To copy a directory and its contents recursively, use the -r option.
cp -r source_directory/ /path/to/destination/
5. Moving and Renaming Files and Directories
• To move a file or directory, use the mv command followed by the
source and destination.
mv file.txt /path/to/destination/
• To rename a file or directory, simply use the mv command with the
new name.
mv old_name.txt new_name.txt
6. Deleting Files and Directories
• To delete a file, use the rm command.
rm file.txt
• To delete an empty directory, use the rmdir command.
rmdir empty_directory/
• To delete a directory and its contents recursively, use the -r option
with rm (be careful with this command, as it deletes files and
directories without confirmation).
rm -r directory_to_delete/
7. Navigating the Linux File System
• To change the current working directory, use the cd command
followed by the path to the desired directory.
cd /path/to/directory
• To view the current working directory, use the pwd command
Pwd
9. File Operations in the Windows GUI
(Graphical User Interface)
• Use File Explorer to navigate through files and folders in Windows.
• Right-click on files or folders to access context menu options, such
as "Copy," "Cut," "Paste," "Rename," and "Delete.“
11. Right-click options in File Explorer:
• "Copy": Copy the selected file/folder.
• "Cut": Cut the selected file/folder.
• "Paste": Paste the copied/cut file/folder.
• "Rename": Rename the selected file/folder.
• "Delete": Delete the selected file/folder.
• "Properties": View and modify file/folder properties, including
permissions.
12. File Permissions and Security in Windows
• In Windows, file permissions are managed using NTFS (New
Technology File System) permissions.
13. In Windows, file permissions are managed using
NTFS (New Technology File System) permissions
• Right-click on the file or folder, and select "Properties."
• Go to the "Security" tab to view and modify permissions for different
users and groups.
14. Cross-Platform Considerations
• When working in a mixed Linux and Windows environment, be aware
of file compatibility and conversion issues.
• Pay attention to file naming conventions, character encoding, and
path differences between the two operating systems.
15. Understanding the -rw-r--r--
• The first character represents the file type: "-" for regular files, "d" for
directories.
• The next three characters represent user permissions, followed by
group permissions, and then others' permissions.
• "r" stands for read, "w" for write, and "x" for execute.
16. Changing File Permissions
• To change permissions for a file:
chmod permissions filename.txt
• For example, to give read, write, and execute permissions to the user:
chmod u+rwx filename.txt
• To give read and execute permissions to the group: chmod g+rx
filename.txt
• To remove write permission from others:
chmod o-w filename.txt
17. Setting File Permissions for Users and Groups
• To change the owner of a file:
chown new_owner filename.txt
• To change the group of a file:
chgrp new_group filename.txt
18. Best Practices for File Security
• Avoid giving unnecessary write permissions to files and directories.
• Use strong passwords and user access controls.
• Regularly update and patch the system and applications to minimize
security vulnerabilities.