Using a Linux distro is a completely different thing. If you are a windows user you can see they have a drive based structure for file system. If I take an example there is a system directory called C:/windows/system32
. If you have another partition they will be D:\ , E:\ etc. All of files and folders are inside of those drives. So every file path is starting with a drive letter. But in Linux we treat all thing as directories. The directory tree is begin with '/' . We call it root of the tree.
/root & /home
[email protected]:~$ ls /
0 dev initrd.img lib64 mnt root snap tmp vmlinuz
bin etc initrd.img.old lost+found opt run srv usr vmlinuz.old
boot home lib
Actually in Linux there are three things called root. Above root of the directory tree is a one. Next we have a super user called 'root'. Also there is a special directory as /root that's owned by root user. this one is equal to home folder of root. Normal users have there own home folders in /home. If your user name is 'us3r' your home folder will be /home/us3r
. I think you ma have see that in many times there is a flag called root.txt in CTF s inside /root. So if you want to get that flag you need to root the mashing.
Hear you can find files those have a variable size. It's a common thing that htdocs folder of server is located in this directory. In early versions that was /var/www
and now that's /var/www/htm
l. Also log files are located inside this directory. (/var/logs)
[email protected]:~$ ls /var
backups lib lock mail run spool unicornscan
cache local log opt snap tmp www
This is the place for temporary files .Usually this folder has the write permission for all. You may find that when uploading a shell to server we first change current directory to /tmp.
This directory comes with commands and data files .There are many sub application files in /usr/share folder.
[email protected]:~$ ls /usr
bin games include lib lib64 local sbin share src var
[email protected]:~$ ls /usr/share
accountsservice gvfs pev
aclocal hal php7.2-common
aclocal-1.16 hamster-sidejack php7.2-json
adduser hashcat php7.2-mysql
afl hashcat-utils php7.2-opcache
aglfn help php7.2-pgsql
airgeddon hexorbase php7.2-readline
alsa hfsprogs php7.2-sqlite3
android-framework-res highlight pipal
ant homebank pixmaps
This folder is responsible for holding all configuration files. If you want to tweak your Is or programs you may need to go there.For a example to change sources in apt you want to edit /etc/sourses.d
[email protected]:~$ ls /etc
adduser.conf gimp menu-methods rmt
adjtime glvnd mercurial rpc
aliases gnome-system-tools mime.types rsyslog.conf
alsa gnuradio miredo rsyslog.d
alternatives groff miredo.conf samba
amap group mke2fs.conf sane.d
anonsurf group- modprobe.d scalpel
apache2 grub.d modules screenrc
apm gshadow modules-load.d securetty
apparmor gshadow- mono security
apparmor.d gss motd selinux
apt gtk-2.0 mpv sensors3.conf
arpwatch gtk-3.0 mtab sensors.d
This directory contains all executable binary files required for booting the system. Commands those run in single user-mode such as ls, ping, chmod are also located hear.
[email protected]:~$ ls /bin
bash findmnt netstat su
btrfs fsck.btrfs networkctl sync
btrfsck fuser nisdomainname systemctl
btrfs-find-root fusermount ntfs-3g systemd
btrfs-image getfacl ntfs-3g.probe systemd-ask-password
btrfs-map-logical grep ntfscat systemd-escape
btrfs-select-super gunzip ntfscluster systemd-hwdb
Hear you can find system libraries and kernel modules.
This folder can be used to hold custom program files. If you wanted to install sublime manually you may copy files to /opt/sublime.
[email protected]:~$ ls /opt
car-hacking firmware-mod-kit sublime_text Teeth xplico
This directory Contains device related files for all hardware devices .
If you are going to mount a new drive you may need this directory.
[email protected]:~$ ls /dev
agpgart kmsg serial tty20 tty47 uhid
autofs log sg0 tty21 tty48 uinput
block loop-control sg1 tty22 tty49 urandom
bsg lp0 sg2 tty23 tty5 vcs
btrfs-control mapper sg3 tty24 tty50 vcs1
bus mem sg4 tty25 tty51 vcs2
cdc-wdm0 memory_bandwidth shm tty26 tty52 vcs3
cdrom mqueue snapshot tty27 tty53 vcs4
cdrw net snd tty28 tty54 vcs5
So I hope you got an idea about Linux directory tree. Thank you for reading. Just leave a comment if somthin is unclear or wrong. :-)