Ubuntu Commands

ctrl+alt+t

launch terminal

ctrl+shift+c

copy selected data from terminal onto clipboard

ctrl+shift+v

paste clipboard data into terminal

ctrl+shift+f

open find window in terminal

git –version

This will give us version of git if it is installed and error if git does not exist

pwd

print working directory

cd

change directory to user's home directory ~

cd <directory_path>

change directory to specific directory path

mkdir

make directory at current location

mkdir <directory_path>

make directory at specific directory path

sudo su

this commands allows us to use terminal with superuser privileges

We can see # symbol instead of $ symbol which signifies super user

the username also get's changed to root@hostname:/home/rntbci#

Whenever we download any software from internet, we get tar.gz zip file in linux downloads folder.

Unzipping a .tar.gz file and installing a package from it on Ubuntu (or any Linux distribution) typically involves a few steps. The .tar.gz file (also known as a "tarball") is a compressed archive that can contain the source code for a software package. Installing a package from source can be a bit more involved than using precompiled packages from your distribution's package manager, but it can be necessary for software not available through those channels.

To unzip or extract the contents of the .tar.gz file, you can use the tar command. The command below will do this:

tar -xvzf package-name.tar.gz

Replace package-name.tar.gz with the name of your file. The options -xvzf are used to extract (x), verbosely list files (v), work with gzip compression (z), and specify the file name (f).

which repo

This command searches for the Repo tool in your system's PATH and outputs the full path to the executable if it's found. For example, it might return /usr/local/bin/repo or ~/bin/repo

sudo find / -type d -name ".repo" 2>/dev/null

In simple terms, sudo find / -type d -name ".repo" 2>/dev/null is used to search the whole filesystem starting from the root for any directories exactly named .repo, doing so with superuser privileges, and it hides any error messages that might arise during this search. This command is particularly useful for system administrators or developers who need to locate all instances of .repo directories, regardless of where they are hidden in the directory structure.

The string abc@def:~$ that you typically see in a Linux terminal is a prompt displayed by the shell. Each component of this prompt provides specific information about the current state of the session or the environment settings for the user. Let's break down what each part means:

Components of the Prompt

  1. abc:

    • Description: This is the username of the currently logged-in user. In this case, the user's name is "abc".

  2. @:

    • Description: This is just a separator used in the prompt to make it easy to distinguish between the username and the hostname.

  3. def:

    • Description: This represents the hostname of the machine (computer) on which the terminal session is running. The hostname "def" can be the network name given to the machine.

  4. ::

    • Description: Another separator used to make the prompt easier to read, typically separating the user and host information from the current directory information.

  5. ~:

    • Description: This symbol represents the home directory of the currently logged-in user, as mentioned previously. When you see ~, it means that the current working directory is the user's home directory.

  6. $:

    • Description: This character is a prompt symbol that indicates the shell is ready to accept commands. The use of $ typically signifies that the session is being run by a normal user. If the user is the root (the administrator), this character is usually replaced by # to indicate elevated privileges.

Overall

So, abc@def:~$ essentially means:

  • "You are logged in as user abc"

  • "On the host named def"

  • "Currently in your home directory (~)"

  • "And ready to accept commands ($) as a regular user (not root)."

The appearance and information presented in the terminal prompt can be customized using the environment variable PS1 in Bash or other similar variables in different shells. This customization can include changing colors, adding or removing information, and modifying how that information is displayed.

Last updated