* * *

Ubuntu installation using Live USB   

 

1. Find out if your system boots in Legacy/ UEFI mode:

  • Boot into Windows

  • Press Win key and 'R' to start the Run dialog

  • In the Run dialog type "msinfo32" and press Enter

  • In the System Information windows, select System Summary on the left and check the value of BIOS mode item on the right

  • If the value is UEFI, Windows boots in UEFI/GPT mode. If the value is Legacy, Windows boots in BIOS/MBR mode.

  • (OPTIONAL READ) source of info - https://wiki.archlinux.org/index.php/Dual_boot_with_Windows )

 

2. Download Rufus ( Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc. ) : https://rufus.akeo.ie/downloads/rufus-3.1.exe

 

3. Download Ubuntu 16.04 iso from here: http://releases.ubuntu.com/16.04/ubuntu-16.04.5-desktop-amd64.iso

 

4. Follow this tutorial to write the iso image on the USB drive: https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows

  • ( if your system boots in LEGACY mode in STEP-1 then choose MBR Partition Scheme for BIOS or UEFI. )

  • ( if your system boots in UEFI mode in STEP-1 then choose GPT Partition Scheme for UEFI. )

 

5. Skip to STEP-3 in this guide ( Make sure you do Step-4 and Step-5 in the linked guide)

https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/

 

6. If after reboot, GRUB doesn’t appear and the system boots directly to Windows, then :

  • Insert the USB drive and reboot, open Ubuntu ( live boot installation )

  • Connect to the internet (personal wifi hotspot/ USB tethering)

  • Goto https://help.ubuntu.com/community/Boot-Repair and type the three commands (sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt-get update
    sudo apt-get install -y boot-repair && boot-repair)

  • Open boot repair and select Recommended repair

  • Reboot, GRUB menu should appear

7. For any issues, try to Google the error.

 

Basic Terminal Commands

1. pwd - present working directory

This command shows the present working directory.

Usage: $pwd

Output(example): /home/admin/Desktop

 

2. cd - change directory

This command is used to change the working directory from one to another.

Usage 1: $cd /var

Output : changes the pwd to /var

Usage 2: $cd ..

Output: changes the pwd to the previous directory (Eg: goes from /home/admin/Desktop

to /home/admin

 

3. ls - list

This command is used to list all the files in a directory.

Usage 1: $ls

Output: Lists all the files and folders in a directory

Usage 2: $ls -a

Output: Lists all the files and folders including the hidden folders in a directory.

Usage 3: $ls -alt

Output: Lists all the files and folders including the hidden ones, their user, and file

Permissions.

 

4. touch

This command is used to create a new document.

Usage: $touch hello

Output: Creates a blank document named ‘hello’

 

5. echo

This command is used to print a statement.

Usage: $echo hello

Result: hello

 

6. cat

This command is used to display the contents of any document.

Usage: $cat hello.txt

Result: All the contents of hello.txt is displayed in the terminal

 

7. head -n

This command is used to display the first ’n’ lines of a document

Usage: $head -10 hello.txt

Result: Displays the first 10 lines of hello.txt in the terminal.Linux Week

8. tail -n

This command is used to display the last ’n’ lines of a document

Usage: $tail -3 hello.txt

Result: Displays the last 3 lines of hello.txt

 

9. tail -f

This command is used to see the last few lines of a document, and it does not exit and

keeps updating the result as new lines are added into the document.

Usage: $tail -f syslog

Result: Shows the log as and when new lines are updated. To exit, press Ctrl+C

NOTE: This is mainly used in analysing real-time events in the log files.

 

10. mkdir - make directory

This command is used to create a new directory.

Usage: $mkdir Documents

Result: A new directory named Documents is created.

 

11. rmdir - remove empty directory

This command is used to remove/delete an empty directory

Usage: $rmdir Documents

Result: Documents is deleted.

 

12. cp - copy

This command is used to copy a file from one location to another.

Usage 1: $cp /home/admin/test.txt /home/admin/Desktop/test.txt

Result: Copies text.txt from /home/admin/test.txt to /home/admin/Desktop/test.txt

Usage 2: $cp test.txt /home/

Result: Copies text.txt from the present directory to /home/

Usage 3: $cp -r /home/admin/Desktop/docs/ /home/admin/

Result: The contents of /home/admin/Desktop/docs/ is copied to /home/admin/

 

13. rm - remove

This is used to remove a file or directory.

Usage 1: $rm test.txt

Result: test.txt is deleted.

Usage 2: $rm -r docs

Result: Deletes a directory named docs which has more files inside.

Usage 3: $rm -rf docs

Result: Force remove docs

 

14. mv - move/rename

This command is used to move or rename files.

Usage 1: $mv /work /home/admin/

Result: Moves /work to /home/admin/

Usage 2: $mv test.txt hello.txtLinux Week

Result: Renames test.txt to hello.txt

 

15. date

Shows the current date and time

Usage: $date

Result : Tue Jan 13 02:39:12 IST 2015

 

16. cal

Shows this months calendar

Usage: $cal

Result: Calendar

 

17. whoami

Displays the user name

Usage: $whoami

Result: admin

 

18. finger user

Displays information about user

Usage: $finger admin

Result: Displays a wide variety of information about user

 

19. uname -a

Displays the system information

Usage: $uname -a

Result: System information

 

20. uptime

Displays the uptime of the computer

Usage: $uptime

Result: 2:42 up 2:08, 2 users, load averages: 1.45 1.63 1.70

 

21. df -h

Shows disk usage

Usage: $df -h

Result: Gives all the disks with their usage information

 

22. du

Shows the directory space usage

Usage: $du

Result: Gives all the contents of the directory with its size

23. reboot

Reboots the system

Usage: $sudo reboot

Result: Reboot the system

 

24. shutdown

Shuts down the system

Usage: $sudo shutdown

Result: shuts down the system


 

25. sudo -i

This command is used to create a password for the root user

Once the command is typed, we are asked to enter the password for our account, after

which a new password can be set for the root account.

 

26. su

Login as root user

Enter the password to become the root user.

 

27. adduser username

This command is used to create a new user. This can be performed only if we are a root

user.

This creates a new user along with a new password for the user.

 

28. passwd username

This command is used to change the password of the existing user.

 

29. ps

This command shows all the processes running in a given system. It is similar to the task

manager in windows.

 

30. kill pid

This command is used to terminate a given process with a given pid (process id)

 

31. chmod <num> <file>

This command is used to edit the file permissions of a file.

read = 4

write = 2

execute = 1

Add the numbers according to the permission you want to give to the user, group and the

world.

Eg: chmod 777 file - gives all permission to all users

Eg: chmod 740 file - rwx for user, r for group and none for the world.

 

32. &&

This is used to connect two commands to be executed one after the other.

Eg: ch .. && ls

 

33. |

A pipe is used to connect two commands in such a way that the output of the first

command is the input of the second command.

Eg: ls | wc -l

 

34. grep

This command is used to search for a given string in a file.Linux Week

Usage 1: $grep “string” file

Result: This shows the occurrence of the string in the files.

Usage 2: $grep -i “string” file

This performs the same function, but case insensitive.

 

35. locate

This command is used to locate a given file.

 

36. tar - file compression

To compress a file, this command can be used.

Usage 1: tar czf file.tar.gz files

Result: creates file.tar.gz from files

Usage 2: tar xzf file.tar.gz

Result: untags file.tar.gz


 

37. Ssh:

Stands for Secure shell, provides a secure connection between two remote computers.

  • Install SSH -

  1. sudo apt update

  2. sudo apt install openssh-server

  3. sudo ufw allow 22

  4. If your port 22 is denied, change port number in /etc/ssh/sshd_config to any big number not listed in /etc/services .

Usage 1: ssh -l username ip address

Result: Asks for the password of the users and then connects it to the destination remote computer.

Usage 2: Access the institute’s server and change your LDAP password

Ssh -l ldapUsername 192.168.1.102

Asks for your LDAP password then

passwd

Result: within an hour LDAP password changes


 

alias:   allows launching of any command or combination of commands by using a preset character or series of characters.

Usage: alias ls = ‘ls -la’ (temporary for a login session, add to ~/.bashrc so that changes are made every login session)

 

dmesg:   reads the kernel messages.

 

ln: used to create symbolic links.

Usage: ln -s -f /path/to/file /path/to/link

 

free:   provides information about unused and used memory and swap space.


 

hostname:   shows or sets a computer's host name and domain name.

 

kdesu:   opens KDE su, the graphical front end for the su command.


 

mkfs:   creates a filesystem on a disk or on a partition thereof.

 

pstree:   displays the processes on the system in the form of a tree diagram.


 

shred:   destroys files.


 

unalias:   removes entries from the current user's list of aliases.

 

w:   shows who is logged into the system and what they are doing.

 

wc:   by default counts the number of lines, words and characters that are contained in text.

 

whatis:   provides very brief descriptions of command line programs and other topics related to Unix-like operating systems.

 

whereis:   locates the binary, source code and man page for any specified program.

 

Linux File System (Explanation of the linux file system structure and the uses of each directory- https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained


 

Useful Applications/Commands in Linux:

 

  1. Goto https://tcpvpn.com , select a server, create an account, download the ovpn config file.

  2. https://askubuntu.com/questions/187511/how-can-i-use-a-ovpn-file-with-network-manager, install this if you cant import ovpn files.

  3. Goto NetworkManager , import the ovpn config file (port 443), enter your username and password, goto advanced settings and set your http proxy.

  4. Connect to the vpn and make sure that no proxy is set in your environment.

 

  1. https://www.techrepublic.com/blog/diy-it-guy/diy-can-i-dual-boot-linux-on-a-dynamic-disk/

  2. https://askubuntu.com/questions/910145/ubuntu-installation-problem-with-dynamic-disks

 

  1. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

  2. ‘quiet’ is for hiding the kernel messages at startup, ‘splash’ is for showing a splash screen  

  3. sudo update-grub

  4. Meaning of parameters - https://askubuntu.com/questions/716957/what-do-the-nomodeset-quiet-and-splash-kernel-parameters-mean

  5. How to update the grub file - https://askubuntu.com/questions/281119/how-do-you-run-update-grub

  6. If you have a nvidia graphic card and you are getting a black screen on boot: https://ubuntuforums.org/showthread.php?t=1613132

see this post also :https://askubuntu.com/questions/716957/what-do-the-nomodeset-quiet-and-splash-kernel-parameters-mean

set these parameters inside GRUB_CMDLINE_LINUX_DEFAULT = “ “ and update the grub file (step e)

 

  • Some files/folders to explore (and Google) on your own -

  1. /etc/fstab

  2. /etc/shadow

  3. /etc/passwd

  4. /etc/sudoers

  5. /etc/default/grub

  6. /etc/sshd_config

  7. /etc/hosts

  8. /var/log/*

  9. /etc/hosts

  10. ~/.bashrc

  • Files where you can set proxy -

  1. ~/.bashrc

  2. ~/.profile

  3. /etc/bash.bashrc

  4. /etc/profile.d/*.sh ( personal script to export proxy at login )

  5. /etc/profile

  6. /etc/environment (DON’T ADD PROXY HERE MANUALLY, USE PROXYMAN INSTEAD)

  7. Network Manager


 

Proxy export format- ( replace ipg_2018xxx with your username and provide password in plaintext)

 

export http_proxy=http://ipg_2018xxx:password@192.168.1.107:3128

export https_proxy=https://ipg_2018xxx:password@192.168.1.107:3128

export HTTP_PROXY=http://ipg_2018xxx:password@192.168.1.107:3128

export HTTPS_PROXY=https://ipg_2018xxx:password@192.168.1.107:3128

export ftp_proxy=ftp://ipg_2018xxx:password@192.168.1.107:3128

export FTP_PROXY=ftp://ipg_2018xxx:password@192.168.1.107:3128

export socks_proxy=socks://ipg_2018xxx:password@192.168.1.107:3128

export SOCKS_PROXY=socks://ipg_2018xxx:password@192.168.1.107:3128

export all_proxy=http://ipg_2018xxx:password@192.168.1.107:3128

export ALL_PROXY=http://ipg_2018xxx:password@192.168.1.107:3128

 

Proxy export format for APT - ( create a file apt.conf in /etc/apt/apt.conf if it doesn’t exist already)

 

Acquire::http::proxy "http://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::https::proxy "https://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::socks::proxy "socks://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::ftp::proxy "ftp://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::HTTP::PROXY "http://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::HTTPS::PROXY "https://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::FTP::PROXY "ftp://ipg_2018xxx:password@192.168.1.107:3128/";

Acquire::SOCKS::PROXY "socks://ipg_2018xxx:password@192.168.1.107:3128/";

 

Use http instead of https in https-proxy in npm (~/.npmrc)

 

proxy=http://ipg_2018xxx:password@192.168.1.107:3128

http-proxy=http://ipg_2018xxx:password@192.168.1.107:3128

https-proxy=http://ipg_2018xxx:password@192.168.1.107:3128/

 

set this in ~/.npmrc or use [npm config set proxy http://ipg_2018xxx:password@192.168.1.107:3128]