Linux Commands Flashcards
(34 cards)
what is cmd to clear the screen in terminal?
clear (short cut: Ctrl + L)
What is the cmd to show the current working directory?
pwd
What is the cmd to list the folders of the current directory?
ls
what is the cmd to list all the processes currently running?
ps
What is the cmd to get the operation system which is currently running?
uname
What is the cmd to end the terminal / shell?
exit (shortcut : Ctrl + d)
what does command “ls- a” do?
Will list all hidden files which start with a “.”
what does command “ls- l” do?
List the list of visible files in a long format
what command is used to access the help manuals built in?
man <option> <command></command></option>
What is the File System Hierarchy Standard which is currently used?
FHS 3.0 released on June 03, 2015
What is the file system structure
Level 0 - root (/)
Level 1 - sbin , media, bin, etc(apt),home(lenin,Desktop, Documnents, Downloads, Pictures, MyCode), tmp, user(bin, sbin,share),lib, var,mnt
File System: traversing the tree
/ is the root of the file system
/ is also the delimiter for sub-directories
. is current directory
.. is parent directory
path for traversal can be absolute or relative
What are the components of typical output of ls -l ?
drwxr -xr -x 5 gphani gphani 12288 Nov 25 10:00 Documents
here “d” denotes file type , here it is directory
rwx (owner permissions)
r-x (Group permissions, - denotes no permission)
r -x (Others permissions)
5 - Number of hard links
gphani - owner
gphani - group (by default there is a group in every user name)
12288 - size
Nov 25 10:00 - Last modified timestamp
Documents - filename
in ls -l format , what does the file descriptor say?
L stands for link to a different directory( like a shortcut)
D stands for directory
- symbolizes regular file
d symbolizes Directory
l symbolizes symbolic link
c symbolizes character file
b symbolizes block file
s symbolizes socket file
p symbolizes Named pipe
C stands for character file which could be read
B stands for Block devices like HDD where data will be read/written in blocks. Typical linux block size is 1Kb
What is an inode?
ls -i <name>
An entry in the filesystem table about the location in storage media
Each unique file will have a unique inode.
If there are multiple entries for the same inode then they are called hard links</name>
What is a hard link?
how to go back to our user root directory
by typing command cd without any arguments.
What does the file system directories contain?
/bin - Essential cmd binaries (could be a link to /usr/bin)
/boot - static files of the boot loader
/dev - device files (Every device in linux is a file)
/etc - host specific system configuration
/lib - essential shared libraries and kernel modules
/media - mount points for removable devices
/mnt -mount points
/opt - Add on application software packages
/run - Data relevant to running processes
/sbin - Essential system binaries
/srv - Data for services (eg. FTP, HTTP services)
/tmp - Temperory files
/usr - secondary hierarchy (shareable user directory)
/var - variable data (log files)
What are the various directories in /usr hierarchy?
/usr/bin - User Commands (all available commands for user)
/usr/lib - Libraries (user specific libraries, may not be available for other users)
/usr/local - Local hierarchy
/usr/sbin - Non-vital system binaries
/usr/share - Architecture dependent data
/usr/include - Header files included by C programs
/usr/src - Source code of various installed applications
What are the various directories in /var hierarchy?
/var/cache - Application cache data
/var/lib - variable state information
/var/local - variable data for /usr/local
/var/lock - lock files
/var/log - log files and directories
/var/run - data relevant to running processes
/var/tmp - temperory files preserved between reboots
What is the difference between a sharable folder vs an unshareable folder?
sharable - a file system that could be shared with many computers to converse storage and uniform file system.
Vs Unshareable.
static shareable - /usr, /opt
static unshareable - /etc, /boot
variable sharable - /var/mail
variable unshareable -/var/run, /var/lock
what does the date command do?
displays current date and time (as set in local computer)
date -R (email format, 24 hr format with GMT)
How to display the dates a file was edited?
date –f <file></file>
What does the command cal do?
displays the calender
cmd “ncal” displays calender in different orientation than that of the command “cal”.. ie., transposes the output of the command “cal”