files

Contents

Roadmap info from roadmap website

Editing Files

Linux, like other operating systems, allows file editing for numerous purposes, whether you need to configure some system functionality or writing scripts. There’s a variety of text editors available in Linux by default, these include: nanovi/vimemacs, and gedit. Each of these has its own learning curve and set of commands.

For instance, nano is a basic text editor, which is easy to use and perfect for simple text file editing. Vi/vim, on the other hand, is more advanced and offers a wide range of features and commands.

To edit a file you first need to open it using a command like:

nano filename

This command will open the file filename in the nano editor. Once open, you can make changes to the file, save, and exit it. Other editors like vi/vim and emacs have their own specific commands for editing, saving and exiting files. It’s essential to learn the basic commands of your chosen editor to efficiently work with files in Linux.

Ref

File TypeDescriptionExample
Regular File (-)Stores data, text, or program information. May contain readable or binary data.file1, file2
Directory (d)A special file that contains a list of files and subdirectories.dirA, dirB
Symbolic Link (l)A pointer to another file or directory.myprogram.2 (→ myprogram.1)
Executable FileA regular file that can be executed as a program.myprogram.1
Special FilesDevices or processes like block, character devices, or pipes. Not shown here./dev/sda (block device)
Socket (s)A file for inter-process communication.Typically in /var/run/
Named Pipe (p)A file for communication between processes.mkfifo created files
DirectoryPurposeExamples of Contents
/The root directory. The starting point of the file system hierarchy.Subdirectories like /bin, /etc, /home, etc.
/binEssential user command binaries needed for system operation, available to all users.Commands like ls, cp, mv, cat, bash.
/sbinEssential system binaries used by the root user for system maintenance and repair.Commands like fsck, reboot, ifconfig.
/etcConfiguration files for system and applications.hosts, passwd, ssh/.
/homeUser home directories, where personal files and settings are stored./home/username directories.
/rootThe home directory for the root user.Files related to the root user.
/varVariable files that change frequently, such as logs, caches, and spools./var/log/, /var/cache/, /var/spool/.
/tmpTemporary files created by applications and the system. Cleared on reboot.Application-specific temporary data.
/usrUser-installed software and libraries, often containing subdirectories like bin, lib, etc./usr/bin/, /usr/lib/, /usr/share/.
/libShared system libraries needed for system programs and kernel modules.Libraries like libc.so, kernel modules in /lib/modules/.
/bootFiles needed to boot the system, including the kernel and bootloader configurations.vmlinuz, grub/.
/devDevice files representing hardware devices and virtual devices./dev/sda, /dev/null, /dev/tty.
/procVirtual filesystem providing process and system information in real-time./proc/cpuinfo, /proc/meminfo, /proc/<PID>.
/sysVirtual filesystem providing information about hardware devices and drivers.Files for kernel and device configuration.
/optOptional software packages and add-on applications.Third-party software installed manually.
/mediaMount points for removable media like USB drives and CDs.Directories created for each mounted device (e.g., /media/usb).
/mntTemporary mount points for manually mounted filesystems.Used by administrators for mounting disks.
/srvData served by the system, such as websites or FTP files.Files for web servers (/srv/http/) or FTP services.
/runRuntime data for processes since the last boot, such as PID files or sockets./run/lock/, /run/user/.
#ready #online #reviewed #linux #operative-system