Technology Encyclopedia Home >How to use the command line terminal on CentOS?

How to use the command line terminal on CentOS?

To use the command line terminal on CentOS, you first need to access it. This can typically be done by opening a terminal emulator application on your desktop environment or by connecting to the CentOS system remotely via SSH.

Once you have accessed the terminal, you can start typing commands. CentOS, like other Linux distributions, uses the Bash shell by default, which provides a command line interface to interact with the operating system.

Here are some basic commands and their explanations:

  1. ls: Lists directory contents.

    • Example: ls /home/user/Documents lists all files and folders in the Documents directory.
  2. cd: Changes the current directory.

    • Example: cd /var/log changes the directory to /var/log.
  3. pwd: Prints the current working directory.

    • Example: pwd outputs the path of the current directory.
  4. cp: Copies files or directories.

    • Example: cp file1.txt file2.txt copies file1.txt to file2.txt.
  5. mv: Moves or renames files or directories.

    • Example: mv oldname.txt newname.txt renames oldname.txt to newname.txt.
  6. rm: Removes files or directories.

    • Example: rm file.txt deletes file.txt.
  7. mkdir: Creates a new directory.

    • Example: mkdir new_directory creates a directory named new_directory.
  8. rmdir: Removes an empty directory.

    • Example: rmdir old_directory deletes old_directory if it is empty.
  9. sudo: Executes a command with superuser privileges.

    • Example: sudo apt-get update updates the package list (note: CentOS uses yum or dnf instead of apt-get).

For managing and running applications in the cloud, you might consider using services like Tencent Cloud's Cloud Virtual Machine (CVM), which provides scalable and reliable cloud computing services. With CVM, you can easily set up a CentOS instance and manage it through the Tencent Cloud Console or via SSH, allowing you to utilize the command line terminal as described.