You are on page 1of 17

WHERE PASSION LEADS TO

EXCELLENCE
Design for Innovative Systems
LINUX basic user guide

ELSYS EASTERN EUROPE


Purpose

•Enabling 1st time LINUX users to do their specific tasks in


LINUX environment

•What this presentation will cover:


• Basic LINUX console commands needed for everyday work
• Invoking apps from console
• Text editors
• Common mistakes

•What this presentation will not cover:


• LINUX OS settings (you will use project defaults)
• Installing apps (IT)
• and many more...
Invoking console

•GUI is makeup, console is life

•Icon on desktop, start menu, or simple right click


WAFER TESTING PRODUCT
General comments/commands

•There is NO RECYCLE BIN; deleted is gone for good

•UNIX/LINUX is case sensitive


• Uppercase and lowercase matters. Everywhere

•man <command>- manual


• Shows built-in manual for command

•exit
• Exits (closes) current console

•which <command>
• Shows full path of any command which can be executed in
console, even built-in one
Paths, syntax

•Absolute (full) path


• Full logical path of file/directory
• Starts with /
• Ex /home/me/my_file.txt

•Relative path
• In respect of current directory
• Considers current directory path as first part of full path
• Ex (if your current location is /home) me/my_file.txt

•Special
• "." represents current directory; ex ./me/my_file.txt
• ".." represents parent directory; ex me/../me/my_file.txt
• "~" represents user home directory; ex ~/my_file.txt
• "*" wildcard; ex */my_f*le.txt
Commands- directories

•pwd - print working directory


• Prints your current location (not always shown in console)

•cd <path>- change directory


• Moves through directory structure- go to path

•mkdir <path>- make directory


• Creates new directory on given path

•rmdir <path>- remove directory


• Destroys directory on given path (must be empty)

•ls <options> <path>- list


• Lists content of given path
• If path argument is omitted, current dir is assumed
Options- list
Option Description
-a Displays all files.
-b Displays nonprinting characters in octal.
-c Displays files by file timestamp.
-C Displays files in a columnar format (default)
-d Displays only directories.
-f Interprets each name as a directory, not a file.
-f Flags filenames.
-g Displays the long format listing, but exclude the owner name.
-i Displays the inode for each file.
-l Displays the long format listing.
-l Displays the file or directory referenced by a symbolic link.
-m Displays the names as a comma-separated list.
-n Displays the long format listing, with GID and UID numbers.
-o Displays the long format listing, but excludes group name.
-p Displays directories with /
-q Displays all nonprinting characters as ?
-r Displays files in reverse order.
-R Displays subdirectories as well.
-t Displays newest files first. (based on timestamp)
-u Displays files by the file access time.
-x Displays files as rows across the screen.
-1 Displays each entry on a line.
Commands- files
•cp <option> <path1> <path2> - copy
• Copies file from path1 to path2
• If -r option is used (recursive), you can copy entire dir structures

•mv <option> <path1> <path2> - move


• Moves file from path1 to path2
• If -r option is used (recursive), you can move entire dir structures
• Renaming is moving file to same location under different name

•rm <options> <path>- remove


• Removes file on given path
• Option -r will do it recoursively removing entire dir structure
• Option -f will force removing write-protected files
•grep <options> <expression> <path>- globally search a regular
expression and print
• Searches for regular expression in given path and prints in console
Regular expressions

•grep can search for complicated patterns to find what you


need.^ Denotes the beginning of a line
$ Denotes the end of a line
. Matches any single character
The preceding item in the regular expression
* will be matched zero or more times
A bracket expression is a list of characters
enclosed by [ and ]. It matches any single
[] character in that list; if the first character of
the list is the caret ^ then it matches any
character not in the list
\< Denotes the beginning of a word
\> Denotes the end of a word
Grep- options

•http://linuxcommand.org/man_pages/grep1.html

• -A NUM print also NUM lines after matching one


• -B NUM print also NUM lines before matching one
• -I skip binary files
• -i ignore case
• -I skip binary files
• -n print line numbers

•Any output, of any command can be redirected to file


• > <filename> - overwrite
• > <filename> - append
File permissions

•There are 3x3 permissions


• read write execute
• For creator, user group, everybody
• so max is rwxrwxrwx (777 octal)

•chmod <option> <path>


• Changes permissions
• To add permission use +, to remove - ; eg chmod +w readonly.txt
• -R option is used for recursive

•You will not always be allowed to change permissions

•You can't access file without required permission


Invoking apps
•Simply type app name; Ex ncsim

•Common text edirtors


• nedit
• gedit
• vi

•Any complicated command can be aliased


• Type alias instead of full command
• Syntax
alias <alias name>="full command"
• Whenever console is started preexisting file .alias/.aliases is sourced
to set your aliases- put it there, and they will always work ;)

Type & at the end of app invoke so you can continue using
console
Few more

•ps command will give you list of active processes

•kill <process number> kills process


• add -9 option for priority
• of course, you need to recognize job

•finger <user ID> gives details on user

•stat <file name> gives details on file ownership/access

•tail <file name> gives end of file on screen

•more <file name> starts printing file on screen

•sed- stream editor https://www.gnu.org/software/sed/manual/sed.html


Final warnings

•To exit vi (default editor for many tools, not intuitive)


• press ESC to exit edit mode then type Q! -quit but don't save
• press ESC to exit edit mode then type wQ!- save and quit

•Think twice before using *, recursion or force

•Do not meddle with other people files even if you have
permissions
Questions?

You might also like