114 lines
3.9 KiB
Markdown
Executable File
114 lines
3.9 KiB
Markdown
Executable File
### 1. pwd command
|
||
To find out the path of the current working directory (folder).
|
||
|
||
### 2. ls command
|
||
To know what files are in the directory you are in.
|
||
|
||
### 3. cd command
|
||
To navigate through the Linux files and directories.
|
||
|
||
### 4. mkdir command
|
||
To create a folder or a directory.
|
||
|
||
$ mkdri folderName
|
||
|
||
### 5. rmdir command
|
||
If you need to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.
|
||
|
||
$ rmdir folderName
|
||
|
||
### 6. rm command
|
||
To delete files and directories within them. Use "rm -r" to delete just the directory.
|
||
|
||
$ rm fileName
|
||
|
||
### 7. touch command
|
||
The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file.
|
||
|
||
$ touch new.txt
|
||
|
||
### 8. cp command
|
||
To copy files from the current directory to a different directory. It takes two arguments: The first is the location of the file to be copied, the second is where to copy.
|
||
|
||
$ cp scenery.jpg /hochmod commandme/username/Pictures
|
||
|
||
### 9. mv command
|
||
To move files through the command line.We can also use the mv command to rename a file.We can also use the mv command to rename a file. For example, if we want to rename the file “text” to “new”, we can use “mv text new”. It takes the two arguments, just like the cp command.
|
||
|
||
$ mv new.txt text.txt
|
||
|
||
### 10. locate command
|
||
You can use this command to locate a file, just like the search command in Windows.
|
||
|
||
$ locate text.txt
|
||
|
||
### 11. echo command
|
||
To move some data into a file.
|
||
|
||
$ echo hello, my name is alok >> text.txt
|
||
|
||
### 12. cat command
|
||
To display the contents of a file. It is usually used to easily view programs.
|
||
|
||
$ cat text.txt
|
||
|
||
### 13. df command
|
||
The df command shows the size, used space, and available space on the mounted filesystems of your computer.
|
||
|
||
### 14. du command
|
||
Use du to know the disk usage of a file in your system.
|
||
|
||
### 15. diff command
|
||
The diff command compares two text files and shows the differences between them. There are many options to tailor the display to your requirements.
|
||
|
||
$ diff file1.ext file2.ext
|
||
|
||
|
||
### 16. tar command
|
||
The tar command is the most used command to archive multiple files into a tarball — a common Linux file format that is similar to zip format, with compression being optional.
|
||
|
||
```
|
||
## Untar files in Current Directory ##
|
||
|
||
tar -xvf file.tar
|
||
```
|
||
|
||
some examples of tar commands
|
||
https://www.tecmint.com/18-tar-command-examples-in-linux/
|
||
|
||
### 17. zip, unzip command
|
||
Use zip to compress files into a zip archive, and unzip to extract files from a zip archive.
|
||
|
||
### 18. uname command
|
||
The uname command, short for Unix Name, will print detailed information about your Linux system like the machine name, operating system, kernel, and so on.
|
||
|
||
### 19.chmod command
|
||
To make a file executable and to change the permissions granted to it in Linux.
|
||
|
||
$ chmod +x numbers.py
|
||
|
||
### 20. hostname command
|
||
To know your name in your host or network. Adding a -i to the end will display the IP address of your network.
|
||
|
||
### 21. ping command
|
||
To check your connectivity status to a server. For example, by simply entering ping google.com, the command will check whether you’re able to connect to Google and also measure the response time.
|
||
|
||
### 22. history command
|
||
The history command lists the commands you have previously issued on the command line. You can repeat any of the commands from your history by typing an exclamation point ! and the number of the command from the history list.
|
||
|
||
### 23. exit command
|
||
The exit command will close a terminal window, end the execution of a shell script, or log you out of an SSH remote access session.
|
||
|
||
### 24. shutdown command
|
||
The shutdown command lets you shut down or reboot your Linux system.
|
||
|
||
### 25. To update System
|
||
|
||
$ sudo apt update
|
||
$ sudo apt upgrade
|
||
|
||
### 26. Find text in files
|
||
Find "Spreadsheets" text in files with extension '.go'
|
||
```
|
||
$find . -type f -name "*.go" -exec grep -lr "Spreadsheets" {} \;
|
||
``` |