Skip to content

Instantly share code, notes, and snippets.

@ifirdavs
Last active January 14, 2023 12:36
Show Gist options
  • Save ifirdavs/c08754579bd57647c012a0d2afce17f7 to your computer and use it in GitHub Desktop.
Save ifirdavs/c08754579bd57647c012a0d2afce17f7 to your computer and use it in GitHub Desktop.
NDG Linux Unhatched Course Notes from netacad.com

NDG Linux Unhatched Course Notes

$ aptitude moo          > There are no Easter Eggs in this program
$ aptitude -v moo         > There really are no Easter Eggs in this program. -v (verbose)
$ aptitude -v -v moo      \ SAME
$ aptitude -vv moo      / SAME

$ pwd > Print Working Directory

~ — representing user's home directory / — root directory .. . — current directory

$ cd /home/sysadmin — absolute path $ cd venv/Scripts — relative path

$ ls > {lists all the content in current directory IN ALPHABETICAL ORDER} $ ls Documents > {all the content in Documents folder} $ ls -l -r > -l — "long display"(ownership, timestamp, date, permissions) output,
$ ls -l -r \ -r — in Reversed order. $ ls -rl > — SAME OUTPUT $ ls -lr /
$ ls -t /var/log/ > -t — sort by Timestamp $ ls -S > -S — sort by Size $ ls -l alternatives.log > shows the details of alternatives.log only!!!

-rw-r--r-- 1 root root 18047 Dec 20 2017 alternatives.log

The first field actually contains ten characters, where the first character indicates the Type of file and the next nine specify Permissions. The file types are:

Symbol File Type Description
d directory A file used to store other files.
- regular file Includes readable files, images files, binary files, and compressed files.
l symbolic link Points to another file.
s socket Allows for communication between processes.
p pipe Allows for communication between processes.
b block file Used to communicate with hardware.
c character file Used to communicate with hardware.

drwxr-x--- 2 root adm 4096 Dec 20 2017 apache2 'd' — directory 'rwxr-x---' — Permissions '2' — Hard Link Count 'root' — User Owner 'adm' — Group Owner '4096' — Size 'Dec 20 2017' ——> Timestamp 'apache2' — Filename

lrwxrwxrwx. 1 root root 22 Nov 6 2012 /etc/grub.conf -> ../boot/grub/grub.conf ——> Symbolic Links

Administrative access $ su — switch to another user (root by default) $ exit $ sudo — implement with administrative rights

Permissions $ ls -l hello.sh
-rw-r--r-- 1 sysadmin staff 647 Dec 20 2017 hello.sh / / -"rw-r--r--" — permissions field -"rw-"r--r-- — owner permissions # owner – sysadmin, can only read and write. -rw-"r--"r-- — group permissions # users in group – staff, can only read. -rw-r--"r--" — other permissions # others can only read.

Permission Types

Permission Effects on File Effects on Directory read (r) Allows for file contents to Without execute permission on the directory, allows for be read or copied. a non-detailed listing of files. With execute permission, ls -l can provide a detailed listing.

write (w) Allows for contents to be modified For this permission to work, the directory must also or overwritten. Allows for files to have execute permission. be added or removed from a directory.

execute (x) Allows for a file to be run as a Allows a user to change to the directory if parent process, although script files require directories have execute permission as well. read permission, as well.

Changing File Permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment