This quick reference helps you get familiar with the following basic Linux commands:
- Application and process management:
which
– Get the full path to a command’s executable file.yum
– Search for, install, remove, and update packages and dependencies for Fedora, CentOS, and Red Hat Enterprise Linux (RHEL).
- Console and output management:
cat
– Display file contents on the terminal.clear
– Clear the terminal display.echo
– Print text or variables in the terminal.top
– Get information about running processes.
- Creating and exporting environment variables:
env
– Display all environment variables running on the system.export
– Export environment variables.printenv
– Print a particular environment variable to the console.source
– Execute commands stored in a file from within the current shell, or refresh environment variables.
- Working with files and directories:
cd
– Change to another directory.cp
– Copy the contents of the source directory or file to a target directory or file.find
– Locate a file or directory by name.grep
– Search for a string within an output.ls
– List the contents of a directory.mkdir
– Create directories.more
– View and traverse the content of a file or stdout.mv
– Move or rename files.pwd
– Get the name of the present working directory.rm
– Delete files or directories.tar
– Extract and compress files.
- Accessing command-line help documentation:
man
– Access manual pages for all Linux commands.
- Working with networks on and from a Linux computer:
curl
– Get or post a file to or from the Internet according to a URL.ip
– Gets the IP information for the physical or virtual machine.netstat
– Get information about network connections and more.ssh
– Establish a secure encrypted connection between two hosts over an insecure network.wget
– Direct download files from the Internet.
- Process management:
&&
– Execute commands in a sequence.kill
– Removes a running process from memory.ps
– Display active processes.
- System control:
poweroff
– Shut down a computer.restart
– Restart a computer.
- User management:
whoami
– Display the user ID.sudo find <starting/directory> -name <file/directory name>
– Finds a file or directory by name.
Excerpt
user add
adduser [options] <username>
Adds a user to the computing environment. The command must be run as sudo
in order
to have administrator access.
Example:
The following example adds a user with the login name cooluser
. The HOME directoryhome
/cooluser
is created by default. Then, the example invokes the commandpasswd
to set a password for the new user:
$ sudo adduser
cooluser
$ sudo passwd
cooluser
Changing password for user
cooluser
.New password:
Retype new password:
passwd: all authentication tokens updated successfully.
No responses yet