Document Details

CheaperCurl

Uploaded by CheaperCurl

Welcomgroup Graduate School of Hotel Administration Manipal

Tags

linux commands unix commands command line computer science

Summary

This document provides information on fundamental Unix/Linux commands such as cd (change directory), ls (list directory contents), man (manual pages), echo (display output), cal (display calendar), and date (display date and time). Each command's syntax and examples are included, making it a useful guide for learning these foundational tools.

Full Transcript

# Unix Commands ## cd (Change Directory) Command - The cd command is used to change the current directory (i.e., the directory in which the user is currently working). ### Syntax: ``` cd [-Options] [Directory] ``` ### Example: | Option | Use...

# Unix Commands ## cd (Change Directory) Command - The cd command is used to change the current directory (i.e., the directory in which the user is currently working). ### Syntax: ``` cd [-Options] [Directory] ``` ### Example: | Option | Use | |:-------|:---------------------------------------------------------------------| | cd .. | Change Current directory to parent directory | | cd ~ | Move to users home directory from anywhere | | cd lab_1 | Change from current working directory to lab_1 | | cd ../downloads | If we are currently in /home/username/documents then we would be placed in /home/username/downloads. | ## Is Command - List directory contents. ### Syntax: ``` Is [Options] [file|dir] ``` ### Example: | Option | Use | |:-------|:--------------------------------------------------------------------------| | Is -l | To show long listing information about the file/directory | | Is -a | List all files including hidden file starting with '.' | | Is -r | List in reverse order | | Is -t | Sort by time & date | | Is -s | Sort by file size | ## man Command - It is the interface used to view the system's reference manuals. ### Syntax: ``` man [command name] ``` ### Example: The image shows a terminal window with the following text: ``` [student@localhost ~]$ man ls ``` This command will display the manual page for the `ls` command. ## echo Command - Display a line of text/string on standard output or a file. ### Syntax: ``` echo [option] [string] ``` ### Example: | Option | Use | |:-------|:---------------------------------| | echo -n | Do not output a trailing newline | | echo -e | Enable interpretation of backslash escape sequences | ### Use | Option | Use | |:-------|:--------------------------------------------------------------------| | \b | It removes all the spaces in between the text | | \n | It creates new line from where it is used | | \t | It create horizontal tab spaces | ## cal Command - Displays a simple, formatted calendar in your terminal. ### Syntax: ``` cal [options] [[[day] month] year] ``` ### Example: | Option | Use | |:-------|:-----------------------------------------------------------------------| | cal -1 | Display single month output. (This is the default.) | | cal -3 | Display three months spanning the date. | | cal -s | Display Sunday as the first day of the week. | | cal -m | Display Monday as the first day of the week. | | cal -j | Use day-of-year numbering for all calendars. These are also called ordinal days. Ordinal days range from 1 to 366. | | cal -y | Display a calendar for the whole year | ## date Command - Print or set the system date and time. ### Syntax: ``` date [OPTION]... [+FORMAT] ``` ### Example: | Option | Use | |:-------|:--------------------------------------------------------------------| | date +%a | The abbreviated weekday name (e.g., Sun) | | date +%A | The full weekday name (e.g., Sunday) | | date +%b | The abbreviated month name (e.g., Jan) | | date +%B | Locale's full month name (e.g., January) | | date +%C | The current century; like %Y, except omit last two digits (e.g., 20) | | date +%w | day of week (0..6); 0 is Sunday | | Option | Use | |:-------|:---------------------------------------------------------------------| | date +%d | Display the day of the month | | date +%m | Displays the month of year (01 to 12) | | date +%y | Displays last two digits of the year(00 to 99) | | date +%Y | Display four-digit year. | | date +%T | Display the time in 24 hour format as HH:MM:SS | | date +%H | Display the hour | | date +%M | Display the minute | | date +%S | Display the seconds | | date +%V | ISO week number, with Monday as first day of week (01..53) | | date +%P | locale's equivalent of either AM or PM | ## clear Command - Clear the terminal screen. - If you take a detailed look after running the clear command, you'll find that it doesn't really clear the terminal. The tool just shifts the text upwards, out of the viewable area. ### Syntax: ``` clear ```

Use Quizgecko on...
Browser
Browser