Question: What are man pages?
Unix's version of Help files are called man pages.
Question: Can we perform regular expression in unix?
Yes, We can do.
We can do using sed.
Full form of SED is stream editor.
For Example(s)
cat /etc/passwd | sed -n '1,3p'
REGEX_DATE='^\d{2}[/-]\d{2}[/-]\d{4}$' echo "$1" | grep -P -q $REGEX_DATE echo $?
Question: What are character meaning in regular expression?
- ^a: Start with a
- a$: End with a
- .: Match any single character.
- *: Match zero OR more occurances.
- [abcd]: Any character from a,b,c and.
- \: Skip the effects of special character.
- [a-z]: Match a-z any character.
- [a-z0-9]: March a-z OR 0-9 any character.
- [[:alnum:]]: Alphanumeric [a-z A-Z 0-9]
- [[:alpha:]]: Alphabetic [a-z A-Z]
- [[:blank:]]: Blank characters (spaces or tabs)
- [[:cntrl:]]: Control characters
- [[:digit:]]: Numbers [0-9]
- [[:graph:]]: Any visible characters (excludes whitespace)
- [[:lower:]]: Lowercase letters [a-z]
- [[:print:]]: Printable characters (non-control characters)
- [[:space:]]: Whitespace
- [[:punct:]]: Punctuation characters
- [[:upper:]]: Uppercase letters [A-Z]
- [[:xdigit:]]: Hex digits [0-9 a-f A-F]
Question: Can we execute multiple command in single statement?
Yes, We can execute multiple commands in single statement.
For Example
sed -e 'command1' -e 'command2' -e 'command3' -e 'command4'
Question: What are the most comman commands?
- cat filename: Displays a filename.
- cd dirname: Moves you to the identified directory.
- cp file1 file2: Copies one file/directory to the specified location.
- file filename: Identifies the file type
- head filename: Shows the beginning of a file
- less filename:
- ls dirname: Display the content of directory.
- mv file1 file2: Rename a file
- tail filename: Display the end of file
- touch filename: Create a blank file.
- whereis filename: Display the location of file
- :
Its used to display the disk space usages.
Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 20509288 15036052 5372988 74% / devtmpfs 2015996 64 2015932 1% /dev tmpfs 2024996 0 2024996 0% /dev/shm /dev/xvdf 103081248 44579524 53258844 46% /var/lib/mysql /dev/xvdg 103081248 89393356 8445012 92% /mnt
Question: What is use of du command?
Its used to display how much space is taking by each directory.
Question: What mount command used for?
mount point is a directory to access your data (files/folders) which is stored in your disks.
Question: What unmount command used for?
To unmount (remove) the file system from your system.
For Example
umount /dev/cdrom
Question: What are the different type of users in unix?
- Root User: It is super admin who have all the access and no need to any further permission.
- System accounts: It have access of system-specific components like mail accounts and the sshd accounts.
- User accounts: User accounts provide interactive access to the system. Users are typically assigned to these accounts and usually have limited access files and directories.
Question: What are the main administrator files?
- /etc/passwd: Keeps the user account and password info.
- /etc/shadow: Holds the encrypted password.
- /etc/group: It have group information.
- /etc/gshadow: secure group account information