Location of the Linux system Folders in local computer
PS C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState \rootfs\
Default Linux folders:
There are some linux default folders. I see them by ls -lah /
/
- Root Directory. Everything is located here. Like filesystembin
- Essential Binaries - contains program binaries such ascat
,echo
, etc.boot
- Static Boot Files -files needed to boot the systemcdrom
- not neededdev
- Device Files -(eg. dev/sta = SATA. not actual files but appear as file) or pseudo-devices that do not correspond to hardware.etc
- Config Files - systemwide config files IMPORTANT to learn in detail for managementhome
- Home Folder - users home folder where a user's data files and user level configuration are located. Need elevated permission (sudo) to change other's file in homelib
- Essential Shared Libraries - shared libraries that is required by programs in bin and sbinmedia
- Removable Media - attached media viz. flash drive, disk drive, etc.mnt
- Mount points - Load additional file system. For example, mounting ./C:/Users//Document location on WSLopt
- Optional Packages - subdirectories for external software that may not adhere to standard file system hierarachy (think about when I installed XAMPP on linux to create the webapp)proc
- Kernal and Process Files - for process and system (similar to files in /dev)root
- Root Home Directory - home directory of root user. Should not work as a root. Better to use an user with root access.run
- Application State Files - Location for application to store transient files lik sockets and process IDs that cannot be stored in /tmpsbin
- similar tobin
but for system administration binariessnap
- Ony appeared on my WSL not on ubuntu vmsrv
- Service Data - data for services provided by the system. Eg. if using Apache HTTP server, place to store website's files in directory heresys
-tmp
- Temporary Files - temporary files. They get deleted when system restartsusr
- User Binary -user's binary and read only data, similar to system but specific to user? Has its ownusr/bin
,usr/lib
,usr/sbin
, etc. Installs locally compiled applications to /usr/local to prevent them from murking up the rest of the systemvar
- Variable Data Files - writable counterpart tousr
directory. is read only in normal operation. Log files written to /usr during normal opearion will be written to /var directory
Other directories I have seen:
share
games
include
src
/etc/passwd
- The User database, with fields giving username, real name, home dir, and other info
/etc/group
- similar to User but for groups, their name, privilates, etc
/etc/shadow
- encrypted file that stores user passwords
Group + USER
add group
groupadd <groupname> -g <groupid>
make a group sudoer - add the group in /etc/sudoer
%<group> ALL =(ALL) NOPASSWD:ALL
- no passwd to do sudo
add user
useradd -d <homedir> -u <uid> -g <gid> -G <group1,group3,group7> -c <comment about name, etc> -e <account expiry date> -f <pwd expiry after days> -s <default bash ie. /bin/bash> <user>
change user password
passwd <user>
make an user sudoer - add following line in /etc/sudoers(.d)
<user> ALL=(ALL) NOPASSWD:ALL
add user to a group
usermod -a -G
check for group
cat /etc/group | grep <groupname>
delete group
need to remove users first
userdel <username>
groupdel <groupname>
List current user with thier privilage
sudo -l
Reading Resources