Intro to Command Line

Command Prompt

  • First item in the prompt is a line representing the user name, followed by the "@" sign, the computer host name, a colon ":", the current working directory and the "$" sign.

user@ubuntuVM:~$
# current_user @ host_name : current_working_directory $
# user = current_user
# ubuntuVM = hostname
# ~ = user's home directory
# $ = logged in as a normal user

root@ubuntuVM:/home/user#
# # = logged in as the root user

whoami

  • whoami - Returns the user name of the current user

user@ubuntuVM:~$ whoami
	user
  • Note Linux is case-sensitive, so the commands are too.

hostname

  • hostname - Returns the name of the current host

pwd

  • pwd - Print working directory

ls

  • ls - List the contents of a directory

cd

  • cd - Change working directory

πŸ“Œ Use only cd to go back to the current user's home directory

alias

  • alias - list bash aliases


Last updated

Was this helpful?