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

Linux Fundamentals 4

The bash prompt displays information for the user, including the username, hostname, and current working directory. It indicates that the system is ready for input. The prompt can be customized and typically includes the username and hostname separated by an @ sign, followed by the current working directory and a $. As the root user, the prompt uses a # instead of $. If login information is missing, the prompt may only show $ or #. The prompt provides context and can be modified to display additional useful information for the user.

Uploaded by

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

Linux Fundamentals 4

The bash prompt displays information for the user, including the username, hostname, and current working directory. It indicates that the system is ready for input. The prompt can be customized and typically includes the username and hostname separated by an @ sign, followed by the current working directory and a $. As the root user, the prompt uses a # instead of $. If login information is missing, the prompt may only show $ or #. The prompt provides context and can be modified to display additional useful information for the user.

Uploaded by

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

󰨇 Dashboard 󰂽 Modules 󰴠 Paths 􏆲

  Purchase Cubes 󰊓 nosredna 󰅀

LINUX FUNDAMENTALS    Page 4 / Prompt Description

Prompt Description 􏅜
 Cheat Sheet

The bash prompt is easy to understand and, by default, includes information such as the user, hostname, and current working
directory. It is a string of characters displayed on the terminal screen that indicates that the system is ready for our input. It typically Table of Contents
includes information such as the current user, the computer’s hostname, and the current working directory. The prompt is usually Introduction
displayed on a new line, and the cursor is positioned after the prompt, ready for the user to start typing a command. Linux Structure 􏅊

It can be customized to provide useful information to the user. The format can look something like this: Linux Distributions 􏅊

Introduction to Shell 􏅊

<username>@<hostname><current working directory>$ The Shell

Prompt Description 􏅊

The home directory for a user is marked with a tilde <~> and is the default folder when we log in. Getting Help

􏆲
   System Information

Work ow
<username>@<hostname>[~]$
􏆲
   Navigation

􏆲
   Working with Files and Directories
The dollar sign, in this case, stands for a user. As soon as we log in as root, the character changes to a hash <#> and looks like this:
􏆲
   Editing Files

􏆲
   Find Files and Directories
root@htb[/htb]#
􏆲
   File Descriptors and Redirections

􏆲
   Filter Contents
For example, when we upload and run a shell on the target system, we may not see the username, hostname, and current working
  Regular Expressions
directory. This may be due to the PS1 variable in the environment not being set correctly. In this case, we would see the following 􏆲

prompts: 􏆲
   Permission Management

System Management
Unprivileged - User Shell Prompt 􏆲
   User Management

􏆲
   Package Management

$ 􏆲
   Service and Process Management

􏆲
   Task Scheduling

Privileged - Root Shell Prompt 􏆲


   Network Services

􏆲
   Working with Web Services

􏆲
   Backup and Restore
#

􏆲
   File System Management

In addition to providing basic information like the current user and working directory, we can customize to display other information 􏆲
   Containerization

in the prompt, such as the date and time, IP address, date, time, the exit status of the last command, and more. This is especially
Linux Networking
useful for us during our penetration tests because we can use various tools and possibilities like script or the .bash_history to
􏆲
   Network Con guration
lter and print all the commands we used and sort them by date and time. For example, the prompt could be set to display the full
path of the current working directory instead of just the current directory name, which can also include the target’s IP address if we Remote Desktop Protocols in Linux

work organized.
Linux Hardening
The prompt can be customized using special characters and variables in the shell’s con guration le (.bashrc for the Bash shell). Linux Security
For example, we can use: the \u character to represent the current username, \h for the hostname, and \w for the current working
􏆲
   Firewall Setup
directory.
􏆲
   System Logs and Monitoring

Special Character Description


Linux Distributions vs Solaris
\d Date (Mon Feb 6) Solaris

\D{%Y-%m-%d} Date (YYYY-MM-DD)


Tips & Tricks
\H Full hostname Shortcuts

\j Number of jobs managed by the shell

\n Newline My Workstation

\r Carriage return

\s Name of the shell


OFFLINE
\t Current time 24-hour (HH:MM:SS)

\T Current time 12-hour (HH:MM:SS)

\@ Current time 􏅄  Start Instance


\u Current username 1 / 1 spawns left

\w Full path of the current working directory

Customizing the prompt can be a useful way to make your terminal experience more personalized and e cient. It can also be a
helpful tool for troubleshooting and problem-solving, as it can provide important information about the system’s state at any given
time.

In addition to customizing the prompt, we can customize their terminal environment with di erent color schemes, fonts, and other
settings to make their work environment more visually appealing and easier to use.

However, we see the same as when working on the Windows GUI here. We are logged in as a user on a computer with a speci c
name, and we know which directory we are in when we navigate through our system. Bash prompt can also be customized and
changed to our own needs. The adjustment of the bash prompt is outside the scope of this module. However, we can look at the
bashrcgenerator and powerline, which gives us the possibility to adapt our prompt to our needs.

 Previous Next   Mark Complete & Next

Powered by  

You might also like