Pages

Command Line in Linux

Yes as you may heard of it, Linux would be operated with commands like Dos commands in Windows. This command also would be called Shell scripting as well. Those Linux commands would work under Bash scripting like batch files in Windows as well. All of my description will walk you through with Ubuntu. 

Essential and convenient shortcut keys


Before looking into commands, these shortcut keys could make your life easy. 

Ctrl+Alt+T

Launch Terminal on Unity.  

Tab

In a terminal, it would completed automatically if there is only one option, otherwise all available options. It would be really great if we would have to type a long file name.

MiddleMouseButton

It would work with "copy and paste at the same time, if a text is highlighted somewhere else on Terminal. 

ArrowUp
ArrowDown
Scroll and edit the command history, which would be executed being followed by <Enter>.

Shift+PageUp
Scroll page up on Terminal.

Shift+PageDown
Scroll page down on Terminal. 

Ctrl+s
Stop any transferring to the Terminal. 

Ctrl+q

Resume transferring to the Terminal. It would be worth trying if Terminal stops responding strange way.

Ctrl+c

Kill the current process. 

Ctrl+z

Send the current process to the background. On the Terminal perspective, it may look like working same as Ctrl+c.

Ctrl+Alt+Del

Show shut down or reboot system options to users. 

Command Line Syntax


In Linux we should use Upper and Lower case precisely because it is sensitive on it. Even searching a certain file on Linux, it should be taken care of.

All commands should be used under one of the following two rules below since OBJECT should be required necessarily or optionally. 

  • command [options] [arguments]
  • command [options] [arguments] OBJECT
Some commands may have either [options] or [arguments], or both of them depending on cases. But mostly commands should work without [options] or [arguments]. And commands could be composed of several words. 

Sanity Expressions


Before jumping into command lines, learning essential expressions would help us to use commands fluently. 

/
Root or Slash. If it is used alone, it would mean "/" directory, which is called Root. If it is done with a directory or several other directories including several /, it would mean one of directory path. 

~
Tilde. It means your home directory. With this, you can easily move down to one of sub-directory under home directory. 

.
Dot. It means the current directory where you are. With this, you can easily move down to one of sub-directory under the current one. 

..
Two dots. It means a parent directory above where you are now. You can simply move up with this. 


|
Pipe. Send output of left-side command execution to right-side as input of the right-side command. It can be used multiple times consequently. 
Note : || would work as OR operator.


&
Ampersand. If it is used any command, the command would run in background. Eg) COMMAND&
Note : && would work as AND operator.

;
Semi colon. Connects several commands sequentially. Unlike |, there is no certain relations among the used commands in-between.

\
Back slash. It would work like concatenation operator. When a space or special character is required, they can be used after \.

PROGRAM
Launch a certain program from Terminal with program name itself. You can just simply type the program on Terminal.

killall PROGRAM
Kill program(s) by name. 

man [Option] COMMAND
Stands for Manual, which requires any COMMAND as an object. 

COMMAND --help
Shows us usage of the command.

Common commands including system information


pwd
Stands for "Print Working Directory" and print the current working path in full name.

cd DIRECTORY
Stands for "Change Directory" and requires a full path as an object.

ls [Option] [File]
Stands for "LiSt" and shows you files in the current directory where you are.
-a, --all : Do not ignore entries starting with ".", which means really everything.
-A, --almost-all : Do not list implied "." and "..".
-c : List entries by columns.
-d : List directories, not their contents. 
-l : Use a long listing format.
-t : Sort by modification time, newest first. 

exit
Logout from Terminal you are using now. If there are multiple Terminals, you can move to another one once it is used. 

reset
Restore a screwed-up Terminal to default settings. 

hostname
Print the name of local host you are currently working on. 

whoami
Print the login name.

who [Option]
Print all usernames and info currently logged in.

id [Option] [USERNAME]
Print real and effective user and group IDs.

finger USERNAME
Lookup user information like login name, mail, plan, or etc. with a program, which is required to be installed if it is tried first time. 

date [Option] [Format]
Print or set the system date and time. 
-d : Display time described by the following string format. Eg) date -d 20161201
-r : Display the last modification time of File. Eg) date -r Filename
-s : Set time described by the following string format. Eg) date -d 20161211

uptime [Option]
Tell how long the system has been running after booted. 

last [Option] [Username] [tty]
Show listing of users last logged-in on your system.

history
Display GNU history of commands you have been used so far. 

uname
Information on your server that you log on now. 
-a : All.
-r : Kernel release.
-v : Kernel version.
-p : Processor type. 

free [Option]
Display amount of free and used memory in the system. 
-b : In Bytes.
-k : In Kilobytes, which is default. 
-m : In Megabytes.
-g : In Gigabytes.
-h : Automatically scaled to shortest three digit unit for human being. 
-t : Add a line showing the column totals.

df [Option]
Stands for "Disk Free", which will be reported. 
-a : Include all pseudo, duplicate, inaccessible file systems.
-B SIZE : Scaled by size unit. Eg) df -B MB
-h : Human readable format and units.

lsmod
Stands for "LiSt MODules in Linux Kernel". It is showed nicely from /proc/modules of your system. 

echo
Display a line of text.

shutdown [Option] [Time] [Message]
Will shut down your system. It will be done in a minute as default with no option. You may overwrite with another shutdown commands or cancel the shutdown command with -c option.  
-h : Power off the machine, which is identical to power off, -P.
-H : Halt the machine. 
-P : Power off the machine, which is identical to power off, -h.
-r : Reboot the machine.  
-c : Cancel shutdown command. 
[Time]
It can be set like following examples. Eg) shutdown 17:20 (at 17:20), shutdown +5 (in 5 minutes), shutdown (in 5 minutes)shutdown now
[Message] 
This message would be shown just right before shutting down, which requires [Time] all the time. 

Basic operations


cp [Option] SOURCE DEST 
cp [Option] SOURCE DIRECTORY
cp [Option] -t DIRECTORY SOURCE
Stands for "CoPy", which requires at least SOURCE and others as usage. SOURCE can be multiple files or a directory itself. 
-i : Prompt before overwrite.
-n : No overwrite existing files.
-r, -R : Copy directories recursively.

mv [Option] SOURCE DEST
mv [Option] SOURCE DIRECTORY
mv [Option] -t DIRECTORY SOURCE
Stands for "MoVe" files to somewhere.
-f : Do not prompt before overwrite.
-i : Prompt before overwrite.
-n : No overwrite existing files.

rm [files]
rm [Option] [FILE]
rm [-r] [files]
Stands for "ReMove". 
-f : Ignore nonexistent files with no prompt. 
-i : Prompt before removal.
-r, -R : Remove directories and their contents recursively.

mcopy [Option] SOURCEFILE TARGETFILE
mcopy [Option] SOURCEFILE [SOURCEFILES...] TARGETDIRECTORY
Copy MSDOS files from/to Unix.

mkdir [Option] DIRECTORY
Stands for "MaKe a new DIRectory".
-m : MODE as permission mode, rwx rwx rwx. 
-p : No error if existing. Make parent directories as needed.

rmdir [Option] DIRECTORY
Stands for "ReMove a DIRectory". 
-p : Remove directory and its ancestor. Eg) "rmdir -p a/b/c" would equal to "rmdir a a/b a/b/c"

File manipulation


cat [Option] [FILE]
"ConCATenate" files and print on the standard output. Eg) cat myfile.txt

more [Option] FILE
COMMAND | more [Option]
Display output on a screen at a time.
-p : Instead of doing not scroll, clear the whole screen and display text.
-c : Instead of doing not scroll, paint each screen from the top, clearing the remainder of each line as it is displayed. 
+NUM : Start at line number NUM.

less [Option]
COMMAND | less [Option]
Display output on a screen at a time.
-e : Quit at EndOfFile.
-n : Use line numbers.
-x : Set tab stops.

touch [Option] FILE
Make files or update the access and modification times of each file to the current time.
-a TIME : Change only the access time. 
-d DATE : Change DATE including Month, Day, and Time.

find [Option] [Path] [Expression]
Search for files or Expression in a directory hierarchy, Path. Default path is the current directory.
-print : Print the full file name on the standard output.
-name : File name.
-size : File size units of space, rounding up.

grep [Options] STRING [File]
Search for STRING in each File. STRING is a basic regular expression (BRE) as default and File can be defined. 
-A NUM : Print NUM lines of trailing context after matching lines. 
-a TEXT : Process a binary file as it is were text.
-B NUM : Print NUM lines of leading context before matching lines. 
-C NUM : Print NUM lines of output context. 
-c COUNT : Suppress normal output.
-i : Ignore case distinctions in both STRING and Files. 
-n NUM : Prefix each line of output with the line number within its input file. 
-R, -r : Recursive.

awk [Option] 'PATTERN' FILE
Stands for "Aho (Hello), Weinberger and Kernighan". It is not a simple command but an interpreter for the AWK Programming Language, which is useful in finding and replacing text within file(s). PATTERN can be expressed as a simple text or combination with operators. Eg) awk 'NR % 2 == 0' data

Process Control


ps [Option]
Stands for "Process Status", which report the processes currently run by the current user. 
-A : Select all processes, which is identical to -e.
-a : Select all processes except both session leaders and non-associated processes to a terminal. 
-d : Select all processes except session leaders.
-e : Select all processes, which is identical to -A.
-f : Do with full list.
PID : List up process ID, PID.

top 
Keep listing the currently running processes, stored by CPU usage, which look like the one in Task Manager of Windows.

fg PID
Stands for 'ForeGround'. Stop process to the foreground or bring a background.

bg PID
Stands for 'BackGround'. Send the process to the background. 
Note : COMMAND& would run COMMAND in the background. 

batch COMMAND
Run COMMAND when the system load is low. I may log out, which let the process keep running.

kill PID
Force a process shutdown. PID can be got using ps command. 

Network applications


ifconfig [Options] [INTERFACE]
ifconfig [Options] INTERFACE ADDRESS
Configure a network interface. INTERFACE should be the name of the interface, for example eth0. If flag indicates up, which is activated otherwise, it says down.
-a : Display all.
-s : Display a short list. 
mtu N : Set MTU of an interface. 
dstaddr addr : Set a remote IP address.
netmask addr : Set the IP network mask for this interface. 
address : IP address to be assigned to the interface. 

ethtool DEVNAME
Query or control network driver and hardware settings. Eg) ethtool eth0

ip [Options] OBJECT [COMMAND] [Options]
-h : Human readable. 
-s : Statistics mode.
-t : Display time stamp. 
OBJECT
address : IPv4 or IPv6 address on a device.
maddress : Multicast address.
monitor : Watch for netlink messages.
route : routing table entry.
Eg) "ip addr show", "ip addr add 1.2.3.4/24 brd + dev eth0", "iroute show", "ip route add default via 1.2.3.254"

ftp [HOST]
Execute FTP access to the HOST, which can be IP address or host name. 

nslookup [Option] [HOST]
A program to query the Internet name servers interactively.

ping [HOST]
Send ping commands several times to the HOST, which can be a host name or an IP address. 

route
route add TARGET
route del TARGET
Show or manipulate the IP routing table. 

netstat

Print network connections, routing tables, interface statistics. 


Administration


su 
Stands for "Super Users". Switch user ID to root privilege user, which is called superuser. Since no password is created for root user as default in Ubuntu, it is not allowed to be accessed without making a password for the root user. 
It sounds like similar to sudo command but su -c would be identical to sudo command. 
-c COMMAND : Execute COMMAND as root user.

sudo
Stands for "Super Users DO". Execute commands as root privilege user or superuser. Since root privilege was given to default user for example, 'taehee' on my system, the password for user 'taehee' user would be required. Once you have a message starting with "Only root may..",  sudo should be front of other executable command. 
It might be confusing but sudo -i would be identical to su command. 
Here is great posting simply explaining differences between su and sudo at  
www.linux.com/blog/how-use-sudo-and-su-commands-linux-introduction.
-i : Run the shell specified by the target user's password.

adduser [Options] USER
adduser SYSTEM [Options] USER
adduser [Options] USER GROUP
addgroup [Options] GROUP
addgroup SYSTEM [Options] GROUP
Add user or group to certain group.
-q : Do not give process information to stdout.
-c FILE : Use FILE as configuration file.

passwd [Options] [USER]
Change user password. Once it is sent, the system will ask you a new password.

chmod [Option] MODE FILE
chmod [Option] FILE
Change a current permission mode of each FILE to another permission MODE; read (r), write (w), and execute (x). And these three are repeated per user, group, and all (world), which means total 9. Then it could be like rwxrwxrwx, or rwxr--r--. 
MODE 
It can be added with +, removed with -, or set with =. Eg) chmod a-x file, chomod u+x testfile, chmod =rwx, g+s file
-R : Recursive.

fdisk [Options] DEVICE
Manipulate disk partition table of the DEVICE.

mount
mount -a [Options]
mount [Options] DEVICE|DIR
Mount a file system.

umount DEVICE
umount -a [Options]
Unmount file systems. 
-a : All of file systems.
-f : Force an unmount. 

tar [Option] [FILE]
Tar archiving utility. Tape archive (compress or uncompressed depending on options)
-A FILE : Append tar files to an archive.
-c FILE : Create a new archive.
-d : Find differences between archive and file system.
-r : Append files to the end of an archive. 
-t : List the contents of an archive. 
-x : Extract files from an archive.

zip [FILE]
Package and compress archive files. 
-A : Adjust self-extracting .exe files. 
-d : Delete entries in zip file.
-m : Move into zip file from OS files. 
-r : Recurse into directories.
-0 : Store only.
-q : Quiet operation without showing progress.

unzip [Options] FILE
Unzip FILE. 


Ubuntu As A Begineer

Since I am a newbie to Linux, I would like to write what I felt based on what I familiar with Windows. There are several things I was not familiar so I would introduce what those are. 


Unity Interface


The most common interface on Ubuntu would Unity. Desktop term was confusing me so here are definition of each part of Unity interface. 



Desktop is the blank part, which would be used when any applications are launched. Dash is a sort of Search in Ubuntu. Panel shows us menu of an application, which is launched once.



Version Management - Standard Releases vs. Long Term Releases (LTS)


It is said a new release of version would be distributed every April and October. There are two different releases; Standard and LTS (Long Term Release). Support period for normal ones would be 9 months while LTS would be 5 years. And each release has its own code name.


Most of recent releases are listed on tables with code name at wiki.ubuntu.com/Releases. It is represented with nice graphs at www.ubuntu.com/info/release-end-of-life.





When you are on certain release of Ubuntu now, the end of support period can be checked with a simple command like ubutu-support-status above.

Directory Structure


Once any Linux is installed, you might notice it has quite different directory structure than Windows. Here is what I have learned while using Ubuntu for a while. Most of Linux have common directory structure but a specific distro may have a bit unique structure.





  • / - It is called the root directory and it is different from /root directory. Since all of files and directories are under /, it is equivalent to C:/ in Windows. If another partition, like D:/ drive in Windows is made in Linux, another / will be seen. 

  • /bin - It is called binary folder and it contains the essential binaries of important system programs and utilities such as bash shell. And /usr/bin includes binaries of applications like Firefox while /sbin contains the essential system administration binaries. 

  • /boot - This contains files that needs to start up the system including Linux kernel (vmlinux), GRUB (boot loader). The configuration files which utilise these files are not included in but in /etc folder.

    • /cdrom - Conventional mount point for CD-ROMs and it is default one in Ubuntu.

    • /dev - Contains all real device files like USB or SATA as well as virtual devices, which do not actually correspond to hardware like /dev/random or /dev/null. 

    • /etc - Includes system-global configuration files, which affect the system's behaviour and all programs. It contains the configuration files for boot-time, network and and so on. 

    • /home - This includes your user named folder like /home/tahee all the time and it contains user-specific configuration files. It would be equivalent to C:/User folder in Windows. 

    • /lib - Contains dynamic libraries and kernel modules, which support binaries in /bin and /sbin. This would be equivalent to DLL's in Windows.

    • /media - Intended for external devices like floppies, CDs, or USBs. It would indicate real physical devices, which should be attached to affiliated mounted folder.

    • /mnt - A place for specifically temporarily dedicated devices like floppies or CD-ROM's. Since it is temporarily mounted directory, each folder under this must be attached to physical storage devices before the folder turns to be accessed properly.  

    • /opt - Optional add-on or package folder. It is commonly used by proprietary software that does not follow the standard file system hierarchy. 

    • /proc - Process Information folder, which includes processes and kernel information as files. Since it is virtual one, it does not exist but stays in system memory only.

    • /root - System sensitive files like .gnupg or .cache. This folder is different from "/", which is called root as well. And /root would not allowed to access with normal user starting with ~$. Once it is changed to ~# with sudo -i command, you can access this folder.


    • /run - This directory gives applications a standard place to store information like sockets and process IDs. 

    • /sbin - See /bin above. 

    • /srv - Service Data folder contains services provided by the system. If Apache web server is used, associated website's files would be stored in the folder. 

    • /sys - System-specific Information folder includes kernel's view of the system.

    • /tmp - Temporary Files includes files stored by applications and generally deleted whenever system is restarted or by utilities. 

    • /usr - User Programs folder contains user application.
      • /usr/bin - Non-essential command binaries for all users. It is not needed in single user mode.
      • /usr/include - Standard include files.
      • /usr/lib - Libraries for the binaries in /usr/bin/ and /usr/sbin/.
      • /usr/local - Tertiary hierarchy for local data. 
      • /usr/sbin - Non-essential system binaries. 
      • /usr/share - Architecture-independent or shared data.
      • /usr/src - Source code like the kernel code with header files.

    • /var - Variable Folder includes variable data such as logs, databases, websites and etc. 
      • /var/cache - Application cache data.
      • /var/lib - State information. Persistent data modified by programs as the run. 
      • /var/lock - Locked files keeping track of resources currently in use. 
      • /var/log - Various log files.
      • /var/mail - Users' mailboxes.
      • /var/opt - Variable data from add-on packages. 
      • /var/run - Run-time variable data.
      • /var/spool - Spool for tasks waiting to be processed. 
      • /var/tmp - Temporary files to be preserved between reboots.

    Installed Software List


    When I got started playing with Ubuntu, I could not find out anything similar to Windows' "Uninstall or change a program" in Ubuntu. 


    There is Ubuntu Software Center, which is similar to Windows' "Uninstall or change a program" and plus Apple's App Store. Installing/Uninstalling programs would be available with Ubuntu Software Center but it is not like Apple's App Store, all of applications are not available in Ubuntu Software Center. So these kinds of software applications like Google Chrome or Microsoft Minecraft should be downloaded from the Internet. 


    A bit further advanced version of this is available; Synaptic, which can be downloaded in Ubuntu Software Center. You may refer to https://help.ubuntu.com/stable/ubuntu-help/addremove.html for a bit further details.




    # References





    Operating System Linux

    There are three different types of Operating Systems in computing systems; Windows, OS X, and Linux. I am pretty sure that most of people have their own experience with at least one of these like Windows, which is more prevalent as of now.

    I would wonder why some people say Linux is way better than Windows. Here are some thoughts from those people and some of them came from myself.


    • Linux is much easier to use
    • Windows is for too general users vs. Linux is for power users
    • Almost free from viruses, free to use software, simple fast and efficient
    • No lagging in speed even though OS upgrades done
    • Could be best platform for young developers

    Even though there are lots of benefits along with Linux, we are still using Windows as we did. We could also think of these benefit along with Windows.


    • We have got used with Windows for a couple of decades
    • Windows has more users, so more attention and critics
    • Still most people would prefer Windows
    • It is mostly pre-installed on a computer and it has more software
    • Compatibility, central management, and easy of use


    Linux Terms


    There are many type of version, called as distribution in Linux. I am going to handle how to deal Ubuntu as reference from now on but reading how many distributions have been developed and spread would be really helpful. Most widely used ones would be Debian (distro - Knoppix, Linux Mint, Ubuntu), Fedora (distro - Red Hat Enterprise Linux), Mandriva Linux, openSUSE, Arch Linux, Gentoo.

    Before jumping into Linux, there are several terms we would need to understand. I would believe understanding these help to utilise it more.


    • Distros and Flavors: Windows has multiple flavors : Home, Professional, and etc. Linux is one of UNIX flavors. Like Windows, Linux has so many Distros (Distributions) like Debian (distro - Knoppix, Linux Mint, and Ubuntu), Fedora (distro - Red Hat Enterprise Linux), Mandriva Linux, openSUSE, Arch Linux, Gentoo
    • Boot Loader or GRUB : Mostly it will simply be a splash screen that pops up and just goes away to boot into the operating system. This is a simple software that loads Linux kernel from the boot partition on the hard disk and can be used to boot other operating systems on the computer. It is also called bootstrap loader or bootstrap generally and in Linux, it would be called as GRUB (GRand Unified Bootloader). 
    • Kernel : This is the core of operating system. In Linux, the kernel would control and manage CPU, memory, and peripherals. It lays between hardware (drivers) and software (System Call  Interface) side. 
    • Shell, Terminal, Command, Bash : The interface between the user, applications, utilities and the kernel of operating system while Terminal application is going to be used in Linux. A Linux Terminal is compatible to DOS prompt in Windows. These kinds of consoles are called Shell. An example of shells in Linux are Bash (Bourne-Again Shell). Generally commands are typed through the Terminal while Shell scripts or Bash scripts especially called in Linux use more programming structure on top of simple commands. Bash scripts are edited in text editor like Nano and they can be saved as *.sh file for further usage like batch files in Windows.
    • Applications and Daemons: Application software/program would be required to work something on Linux as well as other operating systems. Rather than applications, Daemons are other programs which run assisting system itself on Linux background and equivalent to Services on Windows.
    • X Window, Window Manager, Desktops, Unity, GNOME, KDE : Linux has X Window layer consists of graphical windows, which support several Window Manager. A one distro of Linux would support several different Desktops, which lay on top of Window Manager. It makes us really confused though. KDE (Kool Desktop Environment) was brought by openSUSE 12.1, GNOME (GNU Object Model Environment) was introduced by Fedora 16 and Linux Mint 12, and Unity was introduced by Ubuntu 10.10. 

    Install Ubuntu with VirtualBox


    On top of Windows OS, if we would worry about trying new operating systems and think that it could be risk, Virtual Machine on the other OS computer you are currently using would be great choice. VirtualBox which Oracle made would be used as it is prevalent.

    I do not think I would explain every single step we would have to been through with VirtualBox. Here are a few steps while installing it before going to install Ubuntu. The VirtualBox installation file (VirtualBox-5.xxx-Win.exe) would be got from www.virtualbox.org/wiki/Downloads and the Ubuntu installation file (ubuntu-16.xx-desktop-amd64.iso for example) can be downloaded at https://www.ubuntu.com/download/desktop

    Even though HDD 25 GB is recommended by Ubuntu web page and set below, I would prefer set 20 GB personally. Before doing that, based on my experience, choosing Fixed size for physical hard disk would be way easier and smoother to use while doing something else on the host PC.



    And downloaded Ubuntu installation file (*.iso) would be loaded below. 



    Once VirtualBox is installed on your computer, Ubuntu is allowed to be installed based on https://www.ubuntu.com/download/desktop/install-ubuntu-desktop. Here are a couple of steps I would like to point out.


    This popup can be ignored so click Continue button to go through. 



    Extra things to do after installing Ubuntu


    When Windows is installed on a computer, there are lots of things to do like Windows Update or install other application software. Likewise there are things we would need to follow after installing Ubuntu on a computer. 

    Extra things - Update and upgrade latest packages


    I know sending commands through the Terminal on Linux is not easy first time and it might be done with GUI settings. CLI (Command Line Interface) is more prevalent on Linux. 

    1) Go to Terminal with shortcut keys, Ctrl + Alt + T
    2) Command ~$ sudo apt-get update
    3) Command ~$ sudo apt-get upgrade, which may require "y" to go further
    4) Command ~$ sudo apt-get dist-upgrade, which may require "y" to go for it
    5) Command ~$ sudo do-release-upgrade, which may need "y" for that




    Extra things - Audio driver

    When any driver would not work properly with VirtualBox, the associated hardware should be checked out on Linux with this command "~$ lspci". Personally YouTube video did not work since Audio was not set properly with the installed audio hardware. Once any hardware is confirmed on Linux, the same one should be chosen on VirtualBox.






    Extra things - USB thumb drive

    Additionally an external USB thumb drive is inserted to PC, Linux would not detect it properly. With the step below, it would be shown up automatically.




    Extra things - Shared folders

    If any folders are shared between host and guest in virtual machine, it would make our life easier. And what if sharing clipboard or drag & drop between host and guest. These would make our work smoother. In order to do that, Guest Additions CD must be installed on guest in virtual box.

    With recent versions of VirtualBox (I am using 5.1.8), Guest Additions CD image (*.iso) file is installed together. Once Ubuntu is loaded, you can go to Devices > Insert Guest Additions CD images... on the VirtualBox menu. Once installation is done, Terminal will ask you to reboot the guest OS. 




    On the host OS, specify any folder to be shared with the guest one. And on the VirtualBox menu, go to Devices > Shared Folders > Shared Folders Settings, which allows to set shared folders below. Machine folders would allow to work like permanent regardless VirtualBox is running or not while Transient folders would work when VirtualBox is running. If Auto mount and Make permanent are chosen, that would be great. If Make permanent is not chosen, it would turn to Transient folder after VirtualBox is rebooted. 




    Even though it is configured like sharing folders on the guest, Ubuntu, it would not work without guest addition user. Open Terminal and send a command ~$ sudo adduser taehee vbboxsf, which would require to be rebooted, then my user would be allowed to get into the share folder. Whatever folder is made in the host, it would show up as "sf_" prefix under /media/. Since Shared_Vbox folder was shared from host Windows 10 in my case, /media/sf_Shared_Vbox can be seen below. 






    Extra things - Shared Clipboard, Drag and Drop

    Once Shared Folders are set properly, Shared Clipboard or Drag and Drop can be easily set up with clicking bidirectional under VirtualBox menu.