How do you list files in Unix?
💡 Model Answer
In Unix and Unix‑like systems, the primary command for listing files is ls. By default, ls shows the names of files and directories in the current working directory. You can modify its behavior with options: -l for a long listing that includes permissions, ownership, size, and modification time; -a to include hidden files that start with a dot; -h to display sizes in human‑readable format; -R to list directories recursively; and -S or -t to sort by size or modification time. For example, ls -alh shows a detailed, human‑readable list of all files, including hidden ones. You can also pipe ls output to grep to filter by pattern, e.g., ls | grep "\.txt$" to list only text files. The command is simple but powerful, and mastering its options is essential for effective shell navigation.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500