Operations 10 min read

Linux File System Management Tutorial

This tutorial explains Linux file system hierarchy, absolute and relative paths, common directory purposes, command‑line navigation, file creation, copying, moving, deleting, and provides practical Vim editing tips with example commands and code snippets.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Linux File System Management Tutorial

This article provides a step‑by‑step tutorial on managing Linux file directories, covering the overall file system hierarchy, the difference between absolute and relative paths, and the purpose of each standard directory.

Preparation: Use a virtual machine, log in as root, and open a terminal.

Command‑line shortcuts: Arrow keys browse command history, Tab completes commands and arguments, and Ctrl+C cancels a command.

Absolute vs. relative paths: An absolute path starts from the root (e.g., cd /home/zeyang ), while a relative path is based on the current directory (e.g., cd home/zeyang/ when you are in / ).

Linux directory structure and purpose:

/ – root directory (equivalent to C:\ on Windows)

/home – user home directories (e.g., /root, /home/testuser)

/bin – essential executable commands

/sbin – system binaries requiring elevated privileges

/dev – device files (terminals, disks, network cards, etc.)

/lib, /lib64 – shared libraries

/mnt – mount points for external filesystems

/proc – process information (numeric PID directories)

/run – runtime data

/tmp – temporary files (cleared periodically)

/var – variable data such as logs

/boot – boot loader files

/etc – system configuration files (e.g., /etc/passwd, /etc/groups)

/opt – optional application software

/root – root user’s home directory

/sys – kernel and system information

/usr – user programs, libraries, and documentation

FAQ example (making a file executable):

[root@myserver ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates  Videos
Desktop          Downloads  Music                Public    test
[root@myserver ~]# ls -l initial-setup-ks.cfg
-rw-r--r--. 1 root root 1363 Jun 16 21:39 initial-setup-ks.cfg
[root@myserver ~]# chmod +x initial-setup-ks.cfg
[root@myserver ~]# ls -l initial-setup-ks.cfg
-rwxr-xr-x. 1 root root 1363 Jun 16 21:39 initial-setup-ks.cfg

File and directory operations:

Viewing

cd /path – change directory

cd .. – go up one level

cd . – stay in current directory

cd - – return to previous directory

pwd – display current directory

ls – list directory contents

cat /path/file – show file content

more /path/file – paginate file view (quit with q or Ctrl+C)

Creating

touch filename – create an empty file

vim filename – edit a file with Vim

cp source dest – copy files (add -r for directories)

mv source dest – move or rename files/directories

mkdir dirname – create a directory (use -p to create parent directories)

[root@myserver Desktop]# mkdir abc
[root@myserver Desktop]# mkdir abc/cc/bb -p
[root@myserver Desktop]# ls abc/
cc
[root@myserver Desktop]# ls abc/cc/
bb

Deleting

rm file – remove a file (confirm with y)

rm -f file – force delete without prompt

rm -rf directory – recursively delete a directory

[root@myserver Desktop]# rm -rf test/

Updating (renaming)

mv oldname newname – rename a file or directory

[root@myserver Desktop]# mv aa bb
[root@myserver Desktop]# mv a.txt b.txt

Vim editor tips: Install Vim if missing ( yum -y install vim ). Basic workflow: vim file , press i or o to insert, Esc to exit insert mode, :wq to save and quit, :w to save, :q to quit.

Copy/paste: yy (yank), p (paste), prefix with a number for multiple lines.

Delete/undo: dd (delete line), u (undo), ndd (delete n lines), dG (delete to end), dgg (delete to start).

Navigate: G (last line), gg (first line).

Block visual mode: Ctrl+v , select lines, Shift+I to insert text on each line, d to delete selected block.

Colon commands: set nu / set nonu to toggle line numbers, :6 to go to line 6, :%s/hello/abc/g to replace all occurrences, /keyword to search (n/N to move).

For more tutorials, follow the DevOps Cloud Classroom channel.

Command-lineVimSystem Administrationfile system
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.