0% found this document useful (0 votes)
5 views

Basic Linux Commands: Discovering and Using Linux Command

Uploaded by

ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Basic Linux Commands: Discovering and Using Linux Command

Uploaded by

ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Basic Linux Commands

The /etc/passwd file contains a list of the usernames and their respective attributes, such as User ID
(UID), Group ID (GID), User ID info, home directory, and shell. Interesting enough, it doesn’t
normally store the user’s password; another file, called the shadow file (/etc/shadow), now contains a
hashed version of the user’s password.
The shell uses a blank space or a tab to distinguish between the command and options.
This means that you must use a space or a tab to separate the command from the options and the
options from one another. If an option contains spaces, you put that option inside quotation marks. For
example, to search for a name in the password file, enter the following grep command (grep is used
for searching for text in files): grep "Jon B" /etc/passwd
If a command is too long to fit on a single line, you can press the backslash key (\) followed by Enter.
Then continue typing the command on the next line. For example, type the following command (press
Enter after each line):
cat \
/etc/passwd

You can concatenate (that is, string together) several shorter commands on a single line by separating
the commands with semicolons (;). For example, the following command changes the current
directory to your home directory, lists the contents of that directory, and then shows the name of that
directory:
cd; ls -l; pwd

Discovering and using Linux command


Becoming Root User
Su –
When the su command is entered without a username as an option, you will be prompted for the
password of the root account, and a Bash shell will open on behalf of the root account. However, you
can use the su command followed by any user account name, and as long as you supply the correct
password, you will be logged in as that user.
Instead of becoming root by using the su -command, you can type sudo followed by the command
that you want to run as root.

Maintaining the OS
Depending on the version, you will have one of two tools: the Advanced Package Tool (APT) or
Yellowdog Updater, Modified (YUM).
Linux distributions, such as Ubuntu, Debian, and Mint, will use the APT package management tool.
In the operating system you can update the repositories by using the apt command or the apt-get
command.
Sudo apt-get update
Sudo apt-get upgrade
The YUM package manager is used to update and install packages for Red Hat–based Linux
distributions, such as Red Hat Enterprise Server, Fedora, and CentOS.
yum update
yum upgrade
Now that you know how to update the operating system and install packages, it’s inevitable that you’ll
run out of space on the operating system. Fortunately, you can monitor and quickly find out how
much space is free on the disk by using the df command, otherwise known as the disk free command.
By using the df command you can quickly see the percentage of free space, and if you supply the -h
argument you’ll get results in human-readable formats of bytes, as shown here:
user@server:~$ df -h

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy