FICT - Topic 1 - Introduction To Linux (Part 1)
FICT - Topic 1 - Introduction To Linux (Part 1)
What is Linux?
Linux Filesystem
Basic Linux Commands
File Management
User Management
OPERATING SYSTEM
https://upload.wikimedia.org/wikipedia/commons/b/b5/Linux_Di
stribution_Timeline_21_10_2021.svg
OPERATING SYSTEM
command description
/ root directory
. The current directory
.. The parent (previous) directory
~ My home directory (~username for other users home directories)
Examples:
/home/myuser/hello
./a
../fot/egt
LINUX TERMINAL
The “prompt”
The host
LINUX COMMANDS: BASICS
To execute a command,
type the command name ls -l /etc
followed by flags (optional)
and arguments
Command Arguments
name Flags
(optional)
BASIC COMMANDS: FILESYSTEM
cd command is used to
change the working
directory.
BASIC COMMANDS: FILESYSTEM
echo command dumps the entire file into standard output and displays it in the
terminal.
clear command clears the terminal screen.
FILE MANAGEMENT
To easily create, edit and save files in Linux, a simple editor can be used
• nano
• gedit
• vim
• emacs
To create a file in the current working directory:
nano examplefile.txt
To create a file in the current working directory without the use of a text editor:
touch examplefile.txt
FILE MANAGEMENT: VIEW FILES
There are multiple commands to display the contents of a file in the terminal itself.
cat command dumps the entire file into standard output
cat examplefile.txt
less command displays the file allowing forward, backward movement within it
less examplefile.txt
head command displays the top part of the file
head examplefile.txt
head –n50 examplefile.txt (displays the first 50 lines)
tail command displays the last part of the file
tail examplefile.txt
FILE MANAGEMENT: COPY/MOVE/DELETE FILES
adduser command creates a new user. Its better to use the adduser command instead
of the useradd command since it configures the user related settings for you.
adduser exampleuser
passwd command can be used to change the password of users.
who command shows the users who are logged in the system currently while whoami
command shows the user that you are currently logged in as.
USER MANAGEMENT
su command allows you to switch to new account while in the terminal. You will be
prompted for the password for the requested user. Type exit to return back to the
previous user.
su exampleuser
su command can be used without arguments to switch to the root user account.
When you are the root user, you don’t need to enter passwords to switch accounts.
su
By default, the root account is not enabled by default in Ubuntu. To enable the root
account:
sudo passwd root
SUDO
sudo is a program for Unix-like computer operating systems (e. g. Linux) that allows
users to run programs with the security privileges of another user, by default the
superuser. It originally stood for "superuser do" as the older versions of sudo were
designed to run commands only as the superuser.
To run a command with sudo, simply add the sudo command before the command
you desire to run.
You may need to enter the current password of the user when running the sudo
command. The current user should also have the privileges to run the sudo
command.
BASIC COMMANDS: SYSTEM