Basic Linux "Directory Structure, Ownership, Information and Important Command"

Many linux users now do not learn basics that of the unix system itself, how it works and the other stable , most also " they " just trying to existing commands without knowing and understanding the basis of the command itself . and finally " their " pampered and do not want to try and want to get good results only.

I want to tell you I was not the smart users , there are still many that I have to learn and understand , ready for trial and error .

it helps us see below with some explanations that might help you to understand the " system operation " that will be discussed .

I got this material from many sources and also from my guidebook that I can from universities and colleges management informatics technology.

Module:
1. File System Structure : Directory Structure
2. Basic Permission (ownsership): chmod & chown
3. OS Information, Device Information & Kernel
4. Basic Important Command Line


1. File System Structure : Directory Structure

file system "layout" :
file system provides a structure in which information is stored on a hard disk in the computer , the file system can also store data to run the program and configure the operating system settings

The following description of the scheme which I present in the requirements and guidelines for the placement of a directory in linux operating system.


/ = This is the root "/" directory : root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and superuser.
Note : needs to know the directory /root different from the root "/" where / root is the home user and the root "/" single directory

bin = contains binary programs when booting in need, repairing the files needed when running a single user.
sbin = like a /bin, this directory holds commands needed to boot the system who do not usually run by the root user.
etc = contains the configuration program, start, shutdown, startup, stop
dev = This directory is only specific to the placement of the device file that refers to the physical devices such as hard disk, modem monitor keyboard etc.
proc = directory containing the virtual system file that contains information of running processes "process id" or "pid"
var = a.k.a Variable is a Content of the files that are expected to grow can be found under this directory.
usr = This directory contains program binaries, source code and documentation is stored in the other subfolders. for example, such as:
* /usr/bin/ = contains the binary files for user programs, such as: du, awk, tail, etc
* /usr/sbin/ = contains benari file to the administrator, if you can not find a systematic binaries in /sbin/ then look in the directory /usr/sbin. such as: chroot, useradd, userdel, groupadd, groupdel. etc
home = The directory for all users of their personal file storage. suppose there are two users of the "beautiful" and "handsome" then the ownership would be like this:
* /home/beautiful
* /home/handsome
boot = This directory contains the bootloader files and the boot-up process Including the Linux Kernel. such as : initrd.img-(kernel-release)-generic, vmlinuz-(kernel-release)-generic
lib = contains the library files needed to boot, and the kernel module is located under /bin/ and /sbin
opt = aka Optional  contain third-party devices such as, java, metasploit. etc.
mnt = mount directory : temporary directory where sysadmins can mount the file system.
media = directory for removable devices. ex : /media/cdrom for cd-room , /media/usb drives.
srv = This directory contains server-specific and related services.
tmp = directory contains temporary files and will be deleted after reboot or shutdown
lost+found = This directory is useful for recovering damaged files, for example due to a sudden shutdown


2. Basic Permission (ownsership) :
a. chmod
b. chown

a. chmod


This command is useful to change the permissions of a file or directory, set the permissions we want to change.

I created the following scheme to make it easier for us to understand :


- = This suggests that the "-" is a file, and if it becomes a "d" then it could mean it is a directory
rwx =  read, write and execute files by file owner permission
rw- = read, write and execute files that have permissions file owner group members
r-- = read, write and execute files for all other user

The following table permissions for multiple files:

777 (rwxrwxrwx) : not restrict permissions, all users can modify, read and execute the file
755 (rwxr-xr-x) : only the file owner can read, write and mengeksusi files, and other users can only read and execute but not write the file.
700 (rwx ------) : only the owner can read, write and execute the file.
666 (rw-rw-rw-) : all users may read and write the file.
644 (rw-r--r--) : only the owner can read and write files, but other users can only read the file
600 (rw -------) : the owner can read and write files, other users do not have access to the file

The following table permissions for directory :

777 (rwxrwxrwx) : anyone can make a list of new files in the directory and delete the files in the directory
755 (rwxr-xr-x) : only owners who have full access to this directory, other users can only view the course but can not delete and create files into this directory.
700 (rwx ------) : only the owner has full permissions of this directory, other users do not have any access to this directory.

b. chown

Changing the user ID (owner) of a file or directory

for example :

visible above the owners "users" and owners "group" administrator-file.txt file is" root "and" root "

Now let us change the ownership of the user to be "handsome" users


The next change the group owner of the "root" to "handsome"


I see the block ":" and then the group "root" group turns into "handsome". the addition of the character ":" is used when replacing the group owner if it is not in use concurrently with the user owner

chown command syntax :
chown owner-user file
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file


3. OS Information, Device Information & Kernel

The following categories of OS kernel and device information as well as I have described.

cat /proc/version = kernel information
cat /etc/*release = distibution information
cat /proc/cpuinfo = CPU information
cat /etc/passwd = list all users on the system
cat /etc/shadow = show all users hashes
cat /etc/group = list all group on the system
cat /etc/sudoers = for see who's allowed to do as root

uname -a = see all available information systems (kernel relese,system hostname, linux kernel architecture,)
lastlog (ex. lastlog -u `whoami` or lastlog -u handsome) = Information on when the specified user last logged in


4. Basic Important Command Line :

Linux users generally need to know the basic commands common and compulsory in the know as some of the following commands that I will give an example.

1. cd = change directory. ex # cd home/dirfile2/dirfile3
2. ls = to see what files are in a directory, ex /home/
3. cp = copies. copying files from one directory to another directory, for example # cp / home/Downloads/file1.txt  /home/ or directory # cp-r /home/Downloads/directory1 /home/
4. mv = this command to move a file from one directory to another directory. for example # mv /home/Download/file1.txt /home/
5. rm = This command is used to delete a file or folder,for example # rm file.txt or rm /home/file.txt and remove directory just add "-r" for example # mv -r directory or rm -r /home/directory
6. man = this command to show manually from the command we want to use for further information, ex # cp man or man cat. etc
7. more = this command is used to look further than the output that we want to see, for example # netstat-na | more
8. locate = this command is used when looking for a file that we do not know the location where the file is located, for example # locate host.conf
9. netstat = This command shows the network status and protocol statistics and display the status of TCP and UDP in tabular format, information routing, etc., for example # netstat -r
10. whoami = to display the current hostname
11. mkdir = created a new directory, for example # mkdir handsome or mkdir /home/handsome
12. chmod = change the access permission (as I have described above)

maybe that's all I can give many more examples and commands that we should use :) 

it was some brief review I can explain. I am the only user who is not entirely true and if this paper is far from the truth please provide additional comments in the box below. 

regards 

Hidemichi-Hiroyuki a.k.a [H2]

Comments

Popular posts from this blog

Decrypt MD5 $Wordpress

Exploit Samba "SmbClient"

Configure Pure-FTP on Kali Linux