001 linux revision

19
Learn To Be Embedded Linux Training Linux Commands Revision Facebook group: Learn To Be Official website: www.L2b-egypt.org Prepared By: SHATRIX E-Mail: [email protected]

Transcript of 001 linux revision

Page 1: 001 linux revision

Learn To Be Embedded Linux Training

Linux Commands RevisionFacebook group: Learn To BeOfficial website: www.L2b-egypt.org

Prepared By: SHATRIX E-Mail: [email protected]

Page 2: 001 linux revision

2

Learn To Be Embedded Linux Training

Linux History•Unix (Ken Thompson & Dennis Ritchie) AT&T company•FSF & GNU (Gnu is Not Unix) & GPL (Richard Stallman)

1984▫Hurd Kernel

•Minix (Andrew Tanenbaum)• Linux (Linus Torvalds) 1991•GNU/Linux (complete, open source, UNIX-like

operating system)•Open source: software and source code available to all▫The freedom to distribute software and source code▫The ability to modify and create derived works▫Integrity of author's code

Page 3: 001 linux revision

3

Learn To Be Embedded Linux Training

Linux Structure

•BootLoader (grub, uboot, vivi)•Kernel (www.kernel.org)•Filesystem (FHS)• shell (bash & ash & sh)• init process•Scripts & Environment variables•Applications•GUIs & TUI

Page 4: 001 linux revision

4

Learn To Be Embedded Linux Training

Linux principles

•Everything is a file (including hardware)•Small, single-purpose programs•Ability to chain programs together to perform complex

tasks•Avoid user interfaces•Configuration data stored in text

Page 5: 001 linux revision

5

Learn To Be Embedded Linux Training

Linux View

•Gnome & Kde (X Window system)• root & users•Common applications▫gedit, open office, totem, nautilus

• Internet•Terminal•Virtual console•file types▫normal (text, audio, document)▫directory▫special (node, pipe, link (symbolic & hard))

Page 6: 001 linux revision

6

Learn To Be Embedded Linux Training

Filesystem Hierarchy Standard• / root directory• /bin commands & executable files• /sbin system commands & executable files• /boot kernel & bootloader• /dev hardware device files (nodes)• /etc configuration files and startup

scripts• /home users' home directories• /root root home directory• /lib shared library files• /media mount points for storage media• /opt third parity applications• /proc virtual process files• /usr other users applications & libraries• /var files that change a lot

Page 7: 001 linux revision

7

Learn To Be Embedded Linux Training

Commands & help

• command [option(s)] [parameter(s)]•man• info• --help• sudo

Page 8: 001 linux revision

8

Learn To Be Embedded Linux Training

Common commands• cd change directory• pwd print current working directory• ls list files in current directory• cp copy•mv move & rename• touch create a new file•mkdir create a directory• rm remove files• file file type• cat print file contents• less view file contents in pages• passwd change user's password• Absolute and Relative Pathnames

Page 9: 001 linux revision

9

Learn To Be Embedded Linux Training

Text tools

•nano•vim▫modes▫keyboard shortcuts

•gedit

Page 10: 001 linux revision

10

Learn To Be Embedded Linux Training

Permissions

• ls -l

- | --- | --- | ---- | rwx | rwx | rwxt | own | grp | other• chmod▫ letter mode▫numeric mode

•Users & Groups▫chown▫chgrp

Page 11: 001 linux revision

11

Learn To Be Embedded Linux Training

Programs Packages (debian)

•apt-get▫ install update remove

•dpkg▫Binary packages

•Source packages▫./configure [options]▫make▫make install

Page 12: 001 linux revision

12

Learn To Be Embedded Linux Training

man

•man sections 1 5 8•Display manual page descriptions▫man -f command▫whatis what?

•Search the manual page names and descriptions▫man -k pattern▫apropos pattern

Page 13: 001 linux revision

13

Learn To Be Embedded Linux Training

System information commands• whoami print effective user• hostname show or set the system's host name• date print or set the system date and time• cal displays a calendar and the date of Easter▫ cal [[month] year]

• uptime Tell how long the system has been running• w Show who is logged on and what they are

doing• finger user information lookup program▫ finger user-name

• uname print system information▫ uname -a

• free Display amount of free and used memory• df report file system disk space usage• du estimate file space usage▫ du -sh file-or-folder-name

Page 14: 001 linux revision

14

Learn To Be Embedded Linux Training

Pipe & Redirection

• cat file-name | less•Standard output▫command > file

•Standard error▫command 2> file

•The Black hole▫/dev/null

Page 15: 001 linux revision

15

Learn To Be Embedded Linux Training

File Search tools

•whereis locate the location for a command▫whereis command▫whereis -b command

• locate find files by name▫ locate file-name▫updatedb update a database for mlocate

•find search for files in a directory hierarchy▫find path-to-search-in -name search-word

Page 16: 001 linux revision

16

Learn To Be Embedded Linux Training

Text files search tools

•grep print lines matching a pattern▫grep search-pattern file-name▫grep -v▫cat file-name | grep pattern

• cut remove sections from each line of files▫cut -d”delimiter” -f”field” file-name▫cut -d: -f1 /etc/passwd

•Print the shell for a user▫grep root /etc/passwd | cut -d: -f7

Page 17: 001 linux revision

17

Learn To Be Embedded Linux Training

Process Management

•ps report a snapshot of the current processes▫ps axu▫ps axo

• top display Linux tasks•pidof find the process ID of a running program•kill send a signal to a process▫kill pid▫kill -s signal-number pid

•killall kill processes by name▫killall process-name

Page 18: 001 linux revision

18

Learn To Be Embedded Linux Training

Archiving

• tar The GNU version of the tar archiving utility▫tar cf myfile.tar myfolder▫tar xvf myfile.tar▫tar xvf myfile.tar.bz2▫tar xvfz myfile.tar.gz

Page 19: 001 linux revision

Learn To Be Embedded Linux Training

Thank You

Facebook group: Learn To BeOfficial website: www.L2b-egypt.org

Prepared By: SHATRIX E-Mail: [email protected]