728x90
반응형
The operating system used on EC2 servers in AWS is Linux.
Linux is an operating system derived from UNIX, and its commands are almost identical to UNIX.
Here, you will encounter the term "Unix Shell." The Unix Shell provides a user interface for the Unix operating system and Unix-like systems.
Unix allows you to control the computer by executing the shell with string inputs.
The basic commands of Unix are as follows:
- ls (list)
- Lists the files and directories in a directory.
- By default, it shows the files and directories in the current location, but it does not show hidden folders or files.
- Therefore, you need to add options to the command to see them.
- -l: Displays the list with detailed information >> ls -l
- -a: Lists all files, including hidden ones >> ls -al
- -F: Appends a character to the end of each name to indicate the type of file. For example:
- /: Indicates a directory
- *: Indicates an executable file
- cd (change directory)
- Changes the current working directory.
- Example: cd /home/user (Moves to the user's home directory)
- pwd (print working directory)
- Prints the path of the current working directory.
- Example: pwd
- cp (copy)
- Copies files or directories.
- Example: cp source.txt destination.txt (Copies source.txt to destination.txt)
To prevent overwriting, use the -i option.
- mv (move)
- Moves or renames files or directories.
- Example: mv oldname.txt newname.txt (Renames oldname.txt to newname.txt)
- rm (remove)
- Deletes files.
- Example: rm filename.txt (Deletes the file named filename.txt)
- mkdir (make directory)
- Creates a new directory.
- Example: mkdir newdirectory
- rmdir (remove directory)
- Deletes an empty directory.
- Example: rmdir directory
- touch
- Changes the file's creation and modification time or creates a new empty file.
- Example: touch newfile.txt (Creates a file named newfile.txt)
- cat (concatenate)
- Displays or concatenates the contents of files.
- Example: cat file.txt (Displays the contents of file.txt)
- echo
- Prints the given string.
- Example: echo Hello, World!
- man (manual)
- Displays the manual page for a command.
- Example: man ls (Displays the manual page for the ls command)
- grep
- Searches for a specific string within a file.
- Example: grep "searchstring" filename.txt (Searches for "searchstring" in filename.txt)
- find
- Finds files or directories in the file system.
- Example: find / -name "filename.txt" (Finds "filename.txt" in the root directory)
- chmod (change mode)
- Changes the permissions of a file or directory.
- Example: chmod 755 filename.txt (Sets the permissions of filename.txt to 755)
- chown (change owner)
- Changes the owner and group of a file or directory.
- Example: chown user:group filename.txt (Changes the owner of filename.txt to user and the group to group)
- ps (process status)
- Displays the currently running processes.
- Example: ps -ef (Displays detailed information of all processes)
- kill
- Terminates a process.
- Example: kill 1234 (Terminates the process with process ID 1234)
- top
- Displays real-time system processes and resource usage.
- Example: top
- df (disk free)
- Shows the disk usage of the file system.
- Example: df -h (Displays the disk usage in a human-readable format)
- du (disk usage)
- Summarizes the disk usage of a specific directory.
- Example: du -sh /home/user (Displays the total disk usage of the user's home directory)
These commands are frequently used in Unix systems, and each command offers various options for different uses. For more detailed information about a command, you can refer to the manual page using the man command.
728x90
반응형