Podcast
Questions and Answers
What does the ls
command do?
What does the ls
command do?
Lists files and directories within the current directory.
Which command is used to make a new directory?
Which command is used to make a new directory?
- ls
- mkdir (correct)
- rmdir
- cd
The rmdir
command can remove non-empty directories.
The rmdir
command can remove non-empty directories.
False (B)
What is the purpose of the cd
command?
What is the purpose of the cd
command?
What does the cat
command do?
What does the cat
command do?
What does the touch
command do?
What does the touch
command do?
What does the file
command do?
What does the file
command do?
Which option with the wc
command counts the number of lines?
Which option with the wc
command counts the number of lines?
What does the sort
command do?
What does the sort
command do?
What is the purpose of the grep
command?
What is the purpose of the grep
command?
Which command can be used to estimate file space usage?
Which command can be used to estimate file space usage?
Flashcards
ls Command
ls Command
Lists files and directories in the working directory.
mkdir Command
mkdir Command
Creates new directories.
rmdir Command
rmdir Command
Deletes empty directories.
cd Command
cd Command
Signup and view all the flashcards
cat Command
cat Command
Signup and view all the flashcards
banner Command
banner Command
Signup and view all the flashcards
touch Command
touch Command
Signup and view all the flashcards
file Command
file Command
Signup and view all the flashcards
wc Command
wc Command
Signup and view all the flashcards
sort Command
sort Command
Signup and view all the flashcards
grep Command
grep Command
Signup and view all the flashcards
Study Notes
Unix Shell Commands Overview
-
ls (List Directory Contents): Lists files and directories in the current working directory.
ls -l
: Long format showing file permissions, link count, owner, group, size, and timestamp.ls -a
: Displays all files, including hidden ones (those starting with a dot).ls -h
: Formats file sizes to be human-readable (KB, MB).
-
mkdir (Make Directory): Creates new directories.
- Usage:
mkdir [directory_name]
for a single directory, ormkdir -p [path]
for nested directories.
- Usage:
-
rmdir (Remove Directory): Deletes empty directories.
- Usage:
rmdir [directory_name]
needs the directory to be empty; non-empty directories requirerm -r
.
- Usage:
-
cd (Change Directory): Alters the current working directory.
cd [directory_name]
: Enter a specified directory.cd ..
: Move up one directory level.cd ~
: Go to the user's home directory.cd -
: Return to the previous directory.
-
cat (Concatenate and Display Files): Shows file contents and concatenates multiple files.
cat [file_name]
: Displays a single file's contents.cat [file1] [file2] > [newfile]
: Merges two files into a new file.cat > [newfile]
: Creates a new file and enters content (exit with Ctrl+D).
-
banner (Create a Large Banner): Produces ASCII-art style text banners.
- Usage:
banner [text]
outputs the specified text in a large format.
- Usage:
-
touch (Change File Timestamps or Create Empty Files): Updates file timestamps or creates empty files.
- Usage:
touch [file_name]
either creates an empty file or modifies the timestamp of an existing file.
- Usage:
-
file (Determine File Type): Identifies and displays the type of a given file.
- Usage:
file [file_name]
outputs the file type (text, binary, directory, etc.).
- Usage:
-
wc (Word, Line, Character, and Byte Count): Counts text elements in files.
wc -l
: Counts lines.wc -w
: Counts words.wc -c
: Counts bytes.wc [file_name]
: Shows counts for lines, words, and bytes in the specified file.
-
sort (Sort Text Files): Arranges lines of text in files.
sort [file_name]
: Sorts alphabetically by default.sort -r [file_name]
: Sorts in reverse order.sort -n [file_name]
: Sorts numerically.
-
cut (Remove Sections from Each Line of Files): Extracts specific portions from lines of a file.
cut -d [delimiter] -f [field_number] [file_name]
: Extracts fields using a specified delimiter.cut -c [start]-[end] [file_name]
: Extracts characters from defined positions.
-
dd (Convert and Copy a File): Performs low-level file copying and conversion.
dd if=[source_file] of=[destination_file]
: Copies a file from source to destination.dd if=/dev/zero of=[file_name] bs=[block_size] count=[count]
: Generates a file filled with zeros.
-
dfspace (Show Disk Space Usage): Used to show disk space usage (deprecated).
- Current command:
df -h
for human-readable disk space statistics.
- Current command:
-
du (Estimate File Space Usage): Displays disk usage of files and directories.
du -h
: Shows sizes in a human-readable format.du -s [directory_name]
: Reports total size of a specified directory.
-
ulimit (User Limits): Manages system-wide resource limits for users.
ulimit -a
: Displays all current resource limits.ulimit -c [size]
: Sets limit for core file size.ulimit -n [number]
: Sets maximum number of open files.
grep Command
- grep: Stands for "Global Regular Expression Print"; used to search for specific patterns in files.
- Recognized as a powerful command for text searching in Unix.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.