Please enable JavaScript.
Coggle requires JavaScript to display documents.
File Operations, network commands, File Operation - Coggle Diagram
-
network commands
netstat
Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
-
-
-
-
File Operation
find
find command to search for files and directories based on there permission, type, ownership, size and more.it can also combined with other tools such as grep or sed.
Syntax
find [options] [path...] [expression]
To search for files in a directory, the user invoking the find command needs to have read permissions on that directory.
find -L /var/www -name "*.js"
The option -L tells the find command to follow symbolic links.
The /var/www (path) specifies the directory that will be searched.
The (expression) -name "*.js" tells find to search files ending with .js
In linux everything is a file
To search for files based on their types we use -type option
- f - a regular file
- d - directory
- l - symbolic link
- c - character devices
- b - block devices
- p - named pipe(FIFO)
- s -socket
find . -type dFind directories in the current working directory
find /home/linuxize -type f -name document.pdf
To find a file by its name, use the -name option followed by the name of the file you are searching for.
To search for a file named document.pdf in the /home/linuxize
To run a case-insensitive search, change the -name option with -iname
find /home/linuxize -type f -iname document.pdf
The command above will match “Document.pdf”, “DOCUMENT.pdf” ..etc.
find /var/log/nginx -type f -name '*.log.gz'
To find all files ending with .log.gz inside the /var/log/nginx directory
find /var/log/nginx -type f -not -name '*.log.gz'
To find all files that don’t match the regex *.log.gz you can use the -not option
To find files based on the file size, pass the -size parameter along with the size criteria
- b - 512-byte blocks (default)
- c - bytes
- w - two-byte words
- k - Kilobytes
- M - Megabytes
- G - Gigabytes
find /tmp -type f -size 1024cfind all files of exactly 1024 bytes inside the /tmp directoryfind . -type f -size -1Msearch for all files less than 1MB inside the current working directoryfind . -type f -size +1Msearch for files with a size greater than 1MBfind . -type f -size +1M -size 21Mfind all files between 1 and 2MB
find /etc/dovecot/conf.d -name "*.conf" -mtime 5
ilter all files under the /etc/dovecot/conf.d directory that ends with .conf and has been modified in the last five days
find /home -mtime +30 -daystart
list all files in the /home directory that were modified 30 or more days ago
- 1 more item...
-
mv
mv [OPTIONS] SOURCE DESTINATION
The mv command (short from move) is used to rename and move and files and directories from one location to another.
-
-
md5sum
md5sum [OPTION]... [FILE]...
The md5sum computes, and prints or verifies, MD5 128-bit checksums contained in a specified FILE
- b, --binary - Read in binary mode.
- -c, --check - Read MD5 sums from the FILEs and check them.
- --tag - Create a BSD-style checksum.
- -t, --text - Read in text mode (default).
- --quiet - Don't print OK for each successfully verified file.
- --status - Don't output anything, status code shows success.
- --strict - Exit non-zero for improperly formatted checksum lines.
- -w, --warn - Warn about improperly formatted checksum lines.
- --help - Display this help and exit.
- --version - Output version information and exit.
md5sum example.iso
Running the above command would give the md5 checksum of the example.iso file in the current directory. Below is an example of how the output may appear with the full md5 checksum followed by the file name.
d41d8cd98f00b204e9800998ecf8427e example.iso