Skip to content
GK24
Computer AwarenessEasy

Which Linux command displays the full path of the directory you are currently working in?

  1. A.ls
  2. B.pwd
  3. C.cd
  4. D.path

Correct answer

B. pwd

Explanation

The correct answer is B, pwd. The name stands for print working directory, and the command prints the complete path of the directory in which the shell is placed at that moment, counted from the root directory written as a single forward slash. Option A is wrong because ls lists the names of the files and sub-directories inside a directory but does not say where that directory sits in the tree. Option C is wrong because cd changes the directory; in Linux, typing cd with no argument takes the user to the home directory rather than printing the current path, which is a point of difference from MS-DOS, where CD alone displays the current directory. Option D is wrong because path is not a Linux command of this kind; PATH in MS-DOS and the PATH variable in Linux hold the list of directories searched for programs, which is a different idea altogether.

Read the full article: MS-DOS and Linux Commands: Internal, External and Shell

View all
Q4.Computer AwarenessMedium

In Linux, the command chmod 777 on a file gives which set of permissions?

  1. A.Read and write to the owner only
  2. B.Read, write and execute to the owner, the group and others
  3. C.Read and execute to everyone, write to nobody
  4. D.Execute to the owner, read to the group, nothing to others
Show answer
Correct answer: B. Read, write and execute to the owner, the group and others

In the numeric form of chmod each of the three digits stands for one set of users, in the order owner, group and others, and each digit is the sum of read as 4, write as 2 and execute as 1.