I learned the basics of Linux commands through the Cyber Guardians program at the digital forensics club on campus.
How to use and practice commands such as ls cd pwd in the Ubuntu environment
ls = Shows a list of files and folders in the current directory [list]
cd = move to another directory
pwd = Shows the path of the directory you are currently viewing.
ls -a
Prints all hidden files (basically, hidden files are not printed when using ls)
Options Long option description
| -a | —all | Lists all files, including files with names that begin with a period, that are not normally listed (that is, hidden). |
| -A | —almost-all | . Similar to the -a option above, except that it does not list .. (current directory) and .. (parent directory). |
| -d | —directory | Normally, if you specify a directory, ls lists the contents of the directory, not the directory itself. Use this option with the -l option to view details about a directory rather than its contents. |
| -F | —classify | This option adds display characters to the end of each name listed. For example, if the name is a directory, add a forward slash (/). |
| -h | —human-readable | Long format listings display file sizes in human-readable format rather than in bytes. |
| -l | Displays results in long format. | |
| -r | —reverse | Displays results in reverse order. Normally ls displays results in ascending alphabetical order. |
| -S | Sort results by file size. | |
| -t | Sort by modification time. |
Using these options, ls can be used in various ways.
file command
file file name
This allows you to distinguish whether the file is a directory or a file. Specifically, it tells you what type a specific file is.
clear
This is a command that clears the shell window when it becomes too dirty.
less file name
Command to open the file and view it properly. It performs a similar role to cat, but cat reads the contents of the file and distributes them to the shell, so if you refer to the contents and do something, less only opens a new process to view the file properly rather than reading it.
For reference, if you want to close the window viewing the file in that state, you can press the Q key to exit.
mkdir create directory
Create a ln shortcut
rm delete
cp copy
Move or convert mv files