Wednesday, January 18, 2017

Linux: Using the Shell Prompt

As you gain experience with Linux, you’ll discover that it includes some very powerful commands and utilities that you will use over and over. Some of these include the following:


     halt   This command shuts down the operating system but can be run only by the root user.
     reboot   This command shuts down and restarts the operating system. It also can be run only by root.
     init 0   This command also shuts down the operating system and can be run only by your root user.
     init 6   This command also shuts down and restarts the operating system. It also can be run only by root.
     shutdown   This command can be used by root to shut down or reboot the system.
     exit   This command terminates the currently running process, including the current shell session. For example, if you open a terminal session within the Linux GUI and enter exit at the shell prompt, the terminal session is closed. Likewise, if you are working in the CLI and enter exit, the current shell session is ended and you are logged out.
     su   This command switches from the current user to a new user account. For example, if you’re logged in as usera and need to change to user account userb, you can enter su userb at the shell prompt. This command is most frequently used to switch to the superuser root account. In fact, if you don’t supply a username, this utility assumes that you want to change to the root account. If you enter su –,you will switch to the root user account and have all of root’s environment variables applied. When you’re done, enter exit to return to the original user account.
     env   This command displays the environment variables for the currently logged-in user.
     echo   This command is used to echo a line of text on the screen. It’s frequently used to display environment variables. For example, if you wanted to see the current value of the PATH variable, you could enter echo $PATH.
     top   This command is a very useful command that displays a list of all applications and processes currently running on the system. You can sort them by CPU usage, memory usage, process ID number, and which user owns them.
     which   This command is used to display the full path to a shell command or utility. For example, if you wanted to know the full path to the ls command, you would enter which ls.
     whoami   This command displays the username of the currently logged-in user.
     netstat   This command displays the status of the network, including current connections, routing tables, and so on.
     route   This command is used to view or manipulate the system’s routing table.
     ifconfig   This command is used to manage network boards installed in the system. It can be used to display or modify your network board configuration parameters. This command can be run only by the root user.
     uname   This command returns information about your Linux system using several different options, including the following:
     -s   Displays the Linux kernel’s name
     -n   Displays the system’s hostname
     -r   Displays the Linux kernel’s release number
     -v   Displays the Linux kernel’s version number
     -m   Displays the system’s hardware architecture (such as x86_64)
     -p   Displays the processor type
     -i   Displays the hardware platform
     -o   Displays the operating system
     -a   Displays all of this information

No comments:

Post a Comment