Linux ~Basic Command~

Basic Linux Command
1. ls [Option] [File]
Get information of file name and directory name

<Option>
-a : Output all files including hidden files started by dot(.)
-l : Output Long format
-t : Sort files by last updated time
-r : Output with reverse order.
Files started by dot(.) is hidden file and system setting is described in the file in general.
e.g) .bash_profile, .bashhrc.
2. cp [option] [copy source] [copy destination]
Copy file or directory<Option>
-i : Confirmation message will be displayed at the time of file rewrite
-r : Copy directory and the files in the directory
-p : Hold information of original file, such as owner, permission, update time and so on.

3. mv [move resource file] [move destination file]

Move file or change file name<Option>
-i : Confirmation message will be displayed at the time of file rewrite
-f : Move file forcibly

4. rm [File name]
remove file or directory

<Option>
-i : Confirmation message will be displayed at the time of file remove
-r : Remove directory and the files in the directory
-f : Remove file forcibly

5. pwd
Display your current directory.
pwd : Print Working Directory
6. cd [directory name]
move directory

cd : Change Directory

7. mkdir [Directory name]

Create new directory<Option>
-p : Create upper directory of the directory you designated.
8. cat [File name]
Print content of file

<Option>
-n : Print the file content with
9. sort [Option] [File name]
Sort content of the file.<Option>
-r : Sort in reverse order
-k n : Sort by n column data
-n : Sort by number10. uniq [File name]
Duplicate line of the file is omitted.

11. tr [String A] [String B]
Replace String in the file or standard output.
e.g) $ cat sample.txt | tr abc ABC

tr : TRanslate

That’s all for this topic. If you think this article is beneficial for you, I would be glad if you click below icon for my motivation.
ブログランキング・にほんブログ村へ

コメント