Linux Learning
1 Version
Centos is free version of RedHat enterprise
Ubuntu builds on the Debian architecture
2 Common command
`touch <filename>` to create empty file
`last` show history of users logged in to the system
3 man command
`man` have sections , use `man -a` of not sure which section it is
help
is a bash
built-in, providing help for bash
commands only
man
is a system-wide documentation system that provides short reference manuals (pages) for individual commands, API functions, concepts, configuration file syntax, file formats organised in sections (1 for user commands, 2 for system calls...). That's the traditional Unix documentation system.
`man -k <keyword>` to search the command , `apropos` is the alias of `man -k `
4 stdin, stdout, stderror
stdout > direct to file, >> append to file
2 > direct stderror e.g 2 > /dev/null
5 history
6 File hierarchy system (FHS)
man hier to check the explaination of the file system
/bin binary /sbin
/ boot files to start the system
/dev contains system devices
/proc kernal interface
/etc contain the config file
/lib contains the library for bin and sbin
/media /mnt
/ usr
/opt optional
7 File Link
1) Hard link: must be on same device (in the same mount), cannot creat hard link to directory A hard link is nothing but the specific location of physical data. You give various names that refer to the same file. File refers to the same inode as name.
To create hard link.: ln {source} {link} Where,
- source is an existing file.
- link is the file to create (a hard link).
To find the hardlinks of a file
find /dir/to/search/ -samefile /path/to/file/name
2) symbolic Link: goes to a filename, can point to directory . Symbolic links refer to a symbolic path indicating the abstract location of another file. Hard links, refer to the specific location of physical data.
$ ln -s {/path/to/file-name} {link-name}
To delete a link, enter: rm {link-name}
To CHeck symbolic link: ls -l
8 Find
sudo find /etc -size +100k -exec cat {} \; find the file size > 100k and cat
9