Unix Commands is the important topic of the Operating System. Moreover, freestudy9 has all kind of important information and topic related to it.
cal:- Displays a calendar
Syntax: cal [options] [ month ] [year]
- cal displays a simple calendar. If arguments are not specified, the current month is displayed. The switching options are as follows:
- Display single (current) month output. (This is the default.)
- Display prev/current/next month output
- Display Sunday as the first day of the week (This is the default.)
- Display Monday as the first day of the week
- Display Julian dates (days one-based, numbered from January 1)
- Display a calendar for the current year
clear: It clears the terminal screen.
- Clear clears your screen if this is possible, including its scrollback buffer.
- Clear ignores any command-line parameters that may be present.
pwd: Displays path from the root to the current directory
Syntax:- pwd [options]
cd:- It is used to change the directory.
Syntax :- cd [directory]
- Used to go back one directory on the majority of all UNIX shells. It is important that space is between the cd and directory name or ..
- $ pwd
- $ cd progs
- $ pwd
- $ cd ..
ls:- Lists the contents of a directory
Syntax:- ls [options]
- Shows you all files, even files that are hidden (these files begin with a dot.)
- List all files including the hidden files. However, does not display the working directory (.) or the parent directory (..).
- If an argument is a directory it only lists its name, not its contents
- Shows you huge amounts of information (permissions, owners, size, and when last modified.)
- Displays a slash ( / ) in front of all directories
- Reverses the order of how the files are displayed
- Includes the contents of subdirectories
$ ls – l
-rw-r—– 1 student student 23 Jan 16 15:27 file1.txt
- If the first character is – then it is normal file
- If it is d then it is directory
- Field 1 – File Permissions: Next 9 character specifies the files permission. Every 3 characters refer to the read, write, execute permissions for user, group, and world In this example, -rw-r—– indicates read-write permission for user, read permission for the group, and no permission for others.
- Field 2 – Number of links: Second field specifies the number of links for that file. In this example, 1 indicates only one link to this file.
- Field 3 – Owner: the Third field specifies the owner of the file. In this example, this file is owned by username ‘student’.
- Field 4 – Group: Fourth field specifies the group of the file. In this example, this file belongs to ”student’ group.
- Field 5 – Size: Fifth field specifies the size of a file. In this example, ’13′ indicates the file size.
- Field 6 – Last modified date & time: Sixth field specifies the date and time of the last modification of the file. In this example, ‘Jan 16 15:27′ specifies the last modification time of the file.
- Field 7 – File or directory name: The last field is the name of the file or directory. In this example, the file name is file1.txt
exit:- It is used to terminate a program, shell or log you out of a network normally.