On the command line, enter
whoami
or
echo "$USER"
GitHub
github.com › MelissaN › holberton-system_engineering-devops › blob › master › 0x03-shell_variables_expansions › README.md
holberton-system_engineering-devops/0x03-shell_variables_expansions/README.md at master · MelissaN/holberton-system_engineering-devops
Create a script that prints hello user, where user is the current Linux user.
Author MelissaN
Linux Hint
linuxhint.com › print_logged_in_user_names_linux
How to Print the Usernames of Currently Logged-In Users in Linux – Linux Hint
Practical tutorial on how to print the usernames of currently logged-in users in Linux using the "who", "w", "last", "finger", "users", and “whoami" commands.
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › hello world bash shell script
Hello World Bash Shell Script - nixCraft
June 29, 2024 - #!/bin/bash # Usage: Hello World Bash Shell Script Using Variables # Author: Vivek Gite # ------------------------------------------------- # Define bash shell variable called var # Avoid spaces around the assignment operator (=) var="Hello World" # print it echo "$var" # Another way of printing it printf "%s\n" "$var" Run it as follows: $ chmod +x update-hello.sh $ ./update-hello.sh Where, First line of the script (#!/bin/bash) is shebang. It tells the Linux/Unix how to run the script. Each shell comments start with #. Declaring a variable: Variable_Name="Values_here". Next create a program named hello2.sh to display current date and computer/system name as follows:
Baeldung
baeldung.com › home › administration › user administration › running script or command as another user in linux
Running Script or Command as Another User in Linux | Baeldung on Linux
November 17, 2020 - In the script, we first obtain the username with the whoami command. This will capture the username of the user executing the script. Then, we use process substitution to combine the username with the message to be printed.
GeeksforGeeks
geeksforgeeks.org › shell-scripts-to-find-how-many-users-are-logged-in
Shell Scripts to Find How Many Users are Logged In | GeeksforGeeks
April 7, 2025 - This is the only user logged in currently. To show who is logged-in. The who command lists the users with id and the time and date of user login. -a, --all same as –b, -d, --login, -p, -r, -t, -T, -u -b, --boot time of last system boot -d, --dead print dead processes -H, --heading print line of column headings -l, --login print system login processes --lookup attempt to canonicalize hostnames via DNS -m only hostname and user associated with stdin -p, --process print active processes spawned by init -q, --count all login names and number of users logged in
University of Utah
math.utah.edu › docs › info › sh-utils_8.html
GNU shell utilities - User information
This section describes commands that print user-related information: logins, groups, and so forth · id prints information about the given user, or the process running it if no user is specified
GeeksforGeeks
geeksforgeeks.org › linux-unix › shell-script-examples
30+ Common Linux Shell Script Examples - GeeksforGeeks
June 6, 2026 - #!/bin/bash # Prompt the user to enter their name echo "Enter your name:" # Read user input and store it in the variable 'name' read name # Display a greeting message using the stored input echo "Hello, $name! Nice to meet you." read name: Takes input from the user and stores it in the variable name. $name: Retrieves the value stored in the variable and prints it on the screen.