Master the 'ls' Command
5 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

To list all the files present in the current directory ls * 2. to display specific file in directory. ls ______.

filename

List all the file with some extension ls . 4. List out all txt files. ls ______.txt

List out all java files. ls ______.java

List out all the files who’s name start with a ls ______.

<p>a</p> Signup and view all the answers

List out all the files who’s name start with ‘a‘ and end with ‘e‘ ls ______e.*

<p>a</p> Signup and view all the answers

Study Notes

Basic File Listing Commands

  • The command ls * lists all files in the current directory.

Listing Specific Files

  • The command ls filename displays a specific file in the directory.
  • The command ls *.* lists all files with any extension.

Filtering Files by Extension

  • The command ls *.txt lists all text files.
  • The command ls *.java lists all Java files.

Filtering Files by Name Pattern

  • The command ls a*.* lists all files whose name starts with 'a'.
  • The command ls a*e.* lists all files whose name starts with 'a' and ends with 'e'.

Filtering Files by Filename Length

  • The command ls .* lists all files with a two-character filename.
  • The command ls a.* lists all files with a two-character filename and the first character is 'a'.
  • The command ls .*.* lists all files with at least three characters in the filename.

Filtering Files by Multiple Patterns

  • The command ls [aec]* lists all files whose name starts with 'a', 'e', or 'c'.
  • The command ls [^aec]* lists all files whose name does not start with 'a', 'e', or 'c'.

Filtering Files by Case

  • In Ubuntu, the command ls [[:lower:]]* lists all files whose name starts with a lowercase alphabet.
  • In Ubuntu, the command ls [[:upper:]]* lists all files whose name starts with an uppercase alphabet.

Studying That Suits You

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

Quiz Team

Description

Test your knowledge of basic file listing commands with this quiz! From listing all files in a directory to displaying specific files and filtering by file extension, see how well you know the ins and outs of using the 'ls' command. Perfect for beginners and those looking to brush up on their command line skills.

More Like This

Use Quizgecko on...
Browser
Browser