Linux Commands Quiz
14 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the difference between using echo without any options and using echo -n?

Using echo without any options will add a newline at the end of the output, while echo -n will suppress that newline.

How can you display the calendar for the entire year using the cal command?

Use the -y option with cal.

What is the purpose of the -e option in the echo command?

The -e option enables the interpretation of backslash escape sequences.

What is the difference between the cal -s and cal -m options?

<p>The <code>-s</code> option sets Sunday as the first day of the week, while <code>-m</code> sets Monday as the first day.</p> Signup and view all the answers

What does the -j option do to the output of the cal command?

<p>It displays the calendar using day-of-year numbering, also known as ordinal days.</p> Signup and view all the answers

What is the command used to change the current directory to the parent directory?

<p>cd ..</p> Signup and view all the answers

What is the syntax for using the ls command to list all files, including hidden files?

<p><code>ls -a</code></p> Signup and view all the answers

If you are currently in the /home/username/documents directory and want to change to the /home/username/downloads directory, what command would you use?

<p>cd ../downloads</p> Signup and view all the answers

Describe the purpose of the man command.

<p>The <code>man</code> command is used to access and view the system's reference manuals, which contain detailed documentation about various commands.</p> Signup and view all the answers

What command would you use to display the contents of the manual page for the command echo?

<p>man echo</p> Signup and view all the answers

What command is used to clear the terminal screen?

<p>The <code>clear</code> command is used to clear the terminal screen.</p> Signup and view all the answers

How can you display the abbreviated weekday name using the date command?

<p>The <code>date +%a</code> command will display the abbreviated weekday name.</p> Signup and view all the answers

What format specifier is used to display the full month name using the date command?

<p>The format specifier for displaying the full month name is <code>%B</code>.</p> Signup and view all the answers

What does the date +%T command display?

<p>The <code>date +%T</code> command displays the time in 24-hour format as HH:MM:SS.</p> Signup and view all the answers

Study Notes

cd (Change Directory) Command

  • Used to change the current working directory
  • Syntax: cd [-Options] [Directory]
  • Example: cd /home/username/documents
  • Option: cd .. Changes to parent directory
  • Option: cd ~ Moves to the user's home directory
  • Example: cd lab_1 Changes to lab_1 directory
  • Example: cd ../downloads Changes to the downloads directory in the parent directory of the current directory

ls (List) Command

  • Lists the contents of a directory
  • Syntax: ls [Options] [file|directory]
  • Option: -l Shows long listing information about the file/directory
  • Option: -a Lists all files, including hidden files (starting with '.')
  • Option: -r Lists in reverse order
  • Option: -t Sorts by time and date
  • Option: -s Sorts by file size

man Command

  • Used to view the system's reference manuals
  • Syntax: man [command name]
  • Example: man ls Provides information on the ls command.

echo Command

  • Displays a line of text/string on the standard output or a file
  • Syntax: echo [option] [string]
  • Option: -n Suppresses the trailing newline
  • Option: -e Enables interpretation of backslash escape sequences
  • Option: \b Removes trailing spaces
  • Option: \n Creates a newline
  • Option: \t Creates a horizontal tab

cal Command

  • Displays a formatted calendar in the terminal
  • Syntax: cal [options] [[[day] month] year]
  • Option: -1 Displays a single month
  • Option: -3 Displays three months
  • Option: -s Sets Sunday as the first day of the week
  • Option: -m Sets Monday as the first day of the week
  • Option: -j Uses day-of-year numbering
  • Option: -y Displays a calendar for the entire year

date Command

  • Prints or sets the system date and time
  • Syntax: date [OPTION]... [+FORMAT]
  • Option: +%a Displays abbreviated weekday name
  • Option: +%A Displays full weekday name
  • Option: +%b Displays abbreviated month name
  • Option: +%B Displays full month name
  • Option: +%C Displays the century (remove last two digits of year)
  • Option: +%d Displays the day of the month
  • Option: +%H Displays the hour (24-hour format)
  • Option: +%m Displays the month of the year (01-12)
  • Option: +%M Displays the minute
  • Option: +%m Displays the month of the year
  • Option: +%S Displays the seconds
  • Option: +%w Displays day of week (0-6, Sunday = 0)
  • Option: +%y Displays the year (last two digits)
  • Option: +%Y Displays the year (four digits)
  • Option: +%V Displays ISO week number

clear Command

  • Clears the terminal screen
  • Syntax: clear

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Linux Unix Commands PDF

Description

Test your knowledge on basic Linux commands and their options with this quiz. Questions cover the functionality of commands like echo, cal, ls, and man. Whether you're a beginner or looking to refresh your skills, this quiz will help you understand Linux better.

More Like This

Linux Command Line Basics
5 questions
Linux Commands Quiz
48 questions

Linux Commands Quiz

DeftStrontium avatar
DeftStrontium
Linux Commands Quiz
30 questions

Linux Commands Quiz

EnergeticTriumph avatar
EnergeticTriumph
Use Quizgecko on...
Browser
Browser