>
Display all content in directory
ls
Display existing folder path, screen will show folder path
ls -d [Existing Folder]
Example: ls -d Downloads
Export existing folder path to text file
ls -d [Existing Folder] > [Text File].txt
Example: ls -d Downloads > success.txt
Display text file content
cat [Text File].txt
Example: cat success.txt
>>
Append 2nd existing file path to text file
ls -d [2nd Existing Folder] >> [Text File].txt
Example: ls -d Documents >> success.txt
<
Count number of lines, should be 2 lines
cat [Text File].txt
Example: cat success.txt
Use word count command (wc) to count the line, should be return 2 on terminal
wc -l < [Text File].txt
Example: wc -l < success.txt
2>
Display non-existing folder path, screen will return error
ls -d [Random text]
Example: ls -d dsadas
Export error to text file
ls -d [Random text] 2> [Text File].txt
Example: ls -d adasdasd 2> error.txt
2>/dev/null
Run this search command as a regular user (not root)
find /etc -name "passwd"
Terminal will show error message and search result
Run the search command with 2>/dev/null
find /etc -name "passwd" 2> /dev/null
Terminal will show search result only
&>
Export output and error to same text file
find /etc -name "passwd" &> [Text File].txt
Example: find /etc -name "passwd" &> result.txt
<<
Use sort command to sort our data alphabetically
sort << STOP
T
A
O
STOP
Result will show our data arrange alphabetically.