Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

Directory and file operations

Directory and file operations

Editing image format files on Linux

●Rotate the imageThe Linux convert command can be used to rotate images.To rotate an image, add the "-rotate" option to the convert command and specify the rotation angle as an argument.●Enlarge or reduce the imageTo scale an image file, use the convert command with the "-geometry" option. You can specify the width and height as arguments, but if you want to scale the image while keeping the aspect ratio, you can specify the ratio as "%".
Directory and file operations

Sorting files

●Sort by increasing file size.When viewing the files in a directory, they are usually displayed in alphabetical order by file name.However, it is possible to display the desired files and directories in size order.In this case, you can run the ls command with the option "-S" to display the files in order of increasing file size.The "-S" option is an uppercase S.
Directory and file operations

Various ways to view files

●Displays the number of files in a directoryThe ls command allows you to view files in the current directory or in a specific directory.It can also tell you the number of files instead of the file or directory name.In such a case, you can get the number of files by using the find command, which is a file search command, together with the wc command, which does the countingUse the find command with the directory you want to count as an option, the file type with the "-type" option, and then use the pipe "|" to count the number of lines with the wc command with the "-l" option to display the number.
Directory and file operations

File comparison

●Compare two filesTo see if there is a difference between the two files, use the "cmp" command.Specify the file you want to compare as an argument and run it.If there is a difference, it will print the byte position and line number. Also, if there is no difference, the cmp command will not display any message, only a prompt.
Directory and file operations

Extraction of strings and lines in a file

●Extract strings that start with a specific characterIf you want to extract a specific string from a long file, use the grep command.By specifying the string to be extracted and the file as the arguments of the grep command, and by adding "^" (carrot) as an additional condition to extract data starting from a specific string, you can extract data starting from that string.
Directory and file operations

File manipulation with tar command

●View the contents of the archive created by the tar commandTo view the contents of an archive created by the tar command, run the tar command with the "t" option.If you have saved the file as a file, use the "f" option together.If the "v" option is not used, only the names of the files included in the archive will be displayed; if it is used, detailed information such as the attributes of each file will be displayed.※The tar command can omit the "-" (hyphen) option specification.