Basic Shell Commands (1356)
Basic Shell Commands (1356)
https://itsfoss.com/linux-better-than-windows/
https://www.geeksforgeeks.org/7-reasons-why-programmers-should-use-linux/
https://www.smashingrobotics.com/use-linux-with-tools-to-control-your-robot/
https://www.hostinger.com/tutorials/linux-commands
1. pwd command
This command shows the path of the current working directory.
2. cd command
This command changes directory with your path input.
3. ls command
The ls command depicts the contents of a directory.
4. cat command
cat (short for concatenate) is one of the most frequently used commands in Linux. It is used to list
the contents of a file on the standard output (sdout). To run this command, type cat followed by the
file’s name and its extension. For instance: cat test and test2.
5. cp command
Use the cp command to copy files from the current directory to a different directory. For instance,
the command cp logo-white.png /home/fatih/Pictures would create a copy of logo-white.png
(from your current directory Downloads) into the Pictures directory.
Logo-white.png
6. mv command
The primary use of the mv command is to move files, although it can also be used to rename files.
The arguments in mv are similar to the cp command. You need to type mv, the file’s name, and the
destination’s directory. For example: mv redtest.txt /home/fatih/Desktop.
To rename files, the Linux command is mv oldname.ext newname.ext
7. mkdir command
Use mkdir command to make a new directory — if you type mkdir Music it will create a directory
called Music.
There are extra mkdir commands as well:
• To generate a new directory inside another directory, use this Linux basic command mkdir
Music/Newfile
• use the p (parents) option to create a directory in between two existing directories. For
example, mkdir -p Music/2020/Newfile will create the new “2020” file.
8. rmdir command
If you need to delete a directory, use the rmdir command. However, rmdir only allows you to
delete empty directories.
9. rm command
The rm command is used to delete directories and the contents within them. If you only want to
delete the directory — as an alternative to rmdir — use rm -r.
Note: Be very careful with this command and double-check which directory you are in. This will
delete everything and there is no undo.
10.touch comand
The touch command allows you to create a blank new file through the Linux command line. As an
example, enter touch /home/username/Documents/Web.html to create an HTML file entitled Web
under the Documents directory.
15. df command
Use df command to get a report on the system’s disk space usage, shown in percentage and KBs. If
you want to see the report in megabytes, type df -m.
16. du command
If you want to check how much space a file or a directory takes, the du (Disk Usage) command is
the answer. However, the disk usage summary will show disk block numbers instead of the usual
size format. If you want to see it in bytes, kilobytes, and megabytes, add the -h argument to the
command line.