1 / 20

Chapter 5 First step with Linux

Chapter 5 First step with Linux. Linux users . There are three types of users in linux System users: (they are the software/applications users created automatically by the system) e.g mail , MySQL , ftp …..

oceana
Download Presentation

Chapter 5 First step with Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5First step with Linux

  2. Linux users There are three types of users in linux • System users: (they are the software/applications users created automatically by the system)e.g mail , MySQL , ftp ….. • Super user: (the superuser/root user/system administrator is only one, his duties are to install software + create or delete users + look after the system resources ….) the prompt sign of super user is # in all shells . • Normal users: (the normal users can me many , the powers of normal users are limited but normal user has full powers in his home directory ) the prompt sign of normal users in $ in bourne shell and % in c-shell

  3. Some basic commands bin dev home lib etc myfileamYfileamyFilea mntusrmyhomedirbk17oct2013.tar List down files and directories • ls =list down all the files and directories. • ls –a =It will list down all hidden the files and directories • ls –la =It will list down all hidden the files and directories in detail • free=It will show the used , free and total memory of the system. .profile.login bin dev home lib etc myfileamYfileamyFilea mntusrmyhomedirbk17oct2013.tar -rwxrwxrw- 1 root root 5 aug 2008 17:34 .profile • drwxrw-rw- 2 root root 8 aug 2010 12:34 bin • -r—r—r-- 1 usmanali 14 sep 2005 05:12 Myfilea

  4. Some basic commands • tree -dx / / |--bin |--boot |--dev |--etc |--home | |--bilal | |--abid | | |--myfolder | |--usman |--misc |--lost+found |--mnt |--opt |--root |--sbin |--usr This command will display all the directories ‘first level’, +subdirectories ‘second level’ ,++subdirectories ‘third level’ and so on .It will also display files

  5. Directory structure • / “native root” – It is the main directory in which all the rest linux directories are located • /bin -It requires about 550mb of space, contain essential commands used by the system when running and booting Linux. • /sbin -It requires about 550mb of space, contain essential commands used by the system when running and booting Linux. • /boot -It contains Linux kernel which is loaded at boot time.It also contain files that contain information for booting Linux. • /dev -It contains 7500 files representing devices. • /etc -It contains more then 20mb system configuration files and directories .Containing some major software packages like apache , Openssh and passwd file. • /home -It contains the directories of all the normal users, when ever a new user is created then automatically a directory will be created by his/her name inside home directory. when ever a user will login then he/she will automatically will jump in his/her home directory. • /proc -It only exist while Linux is running and it shows different memory usage. • /usr -It is approx 5GB in size and contains software applications and libraries. • /tmp -it is used for temporaty file storage.The tmp directory is cleaned of each day and will delete files that are not used for 10 days. • /var -It contains directories and sub directories used by various system services e.g mail , ftp etc…

  6. Session(log in and log out) When you login to the system a session is established and when you logoff the session is ended. Different ways to login • You can connect and establish a session by using keyboard, monitor and a mouse attached to your pc. • You can connect by dial-up modem and establish a session. • You can connect through a wired network and establish a session. • You can connect through a wireless network and establish a session.

  7. Session Requirements(log in and log out) • Stand alone pc Requirements: • User (optional) • Password (optional) • Local Area Network pc Requirements: • User • Password • System name or IP address • Wide area Network Pc Requirements: • User • Password • System name of IP address • Port number (optional, default ports ftp 21,telnet 23,ssh 22)

  8. Session Working with Consoles • Increasing the number of consoles/terminals • F1,F2,F3,F4,F5,F6 …. • Jumping back to the precious terminal or another terminal • Alt+F4 • Alt+F3 • Alt+F1 The first console by default name is vt1 and if You increase there number , they will be given a name by the system like vt2, vt3,vt4…

  9. Session COMMANDS • logout • exit • Ctrl+D To end a Session

  10. Session The best and the most secure way to log in a remote Linux computer is to use SSH (Secure Shell), it has two parts(server side ssh and client side ssh). Secure Shell Client side windows ssh Server side linuxssh

  11. Commands Some important commands of this chapter • chfn -To change the user information such as address,phone,email.… e.gchfnusman • finger –To view the user information e.gfinger usman. • grepusman /etc/passwd –once the user information is changed , automatically the changes will be made in passwd file which contains the latest information of all the users. The command grepwill only find out the information of the user usman. • apropos -It will display the command related information. e.gapropos partition . • man -It will also display the command related information. e.gman date. (already done ) • whereis-It will find out the command and its documents on the entire file system and will display the output along with the path e.gwhereisfdisk. • links -It will display html pages not in only text mode, but in a slightly better GUI. This command is also helpful if the web browser is not working then you use links command to browse the pages. e.glinks /home/umar/myweb/index/html • which -It will display the information of a shell, e.gwhich tsch • chsh-To change a shell. e.gchsh –s /bin/tschorchsh –s /bin/csh. the option –s is used to set the new shell . • env-To view the environment “settings” of a user, the home directory path, the shell which the user is using, the by default language etc…. e.genv

  12. Commands Back to user Home directory When ever a new user is created, linux will automatically create a folder by exact user name on the path /home • cd -To move and to go into the home directory of a user. If user usman is on the path /home/ali and he want to go to his home directory which will be /home/usman then he will type the command cd • cd $HOME -To move and to go into the home directory of a user. If user usman is on the path /home/ali and he want to go to his home directory which will be /home/usman then he will type the command cd $HOME • cd ~ -To move and to go into the home directory of a user. If user usman is on the path /home/ali and he want to go to his home directory which will be /home/usman then he will type the command cd ~

  13. Commands Removing/creating files and directories + meta charactor • rm -To remove a file. e.grm file21 • rm –R -To remove a directory and all the files and subdirectories inside e.grm –R mydir33 • rm file* -It will remove all the files starting from the name file no matter how lengthy there name is, will remove file1, file111, fileabc43er, fileg * is a meta character which has a special meaning behind it (meaning every thing) • rm file? -It will remove all the files starting from the name file and just one more extra character in the name, will remove file1, fileB, filec, file8. ? again is a meta character which has a special meaning behind it (meaning just one character or letter), it acts like a fill in the blank • rmf?l? -It will remove all the files starting with the first letter f and the second may be any character/number ,third letter must be l and fourth may be any character/number f just one more, will remove file, fBl2, f5l7, f9le, f3lg. ? again is a meta character which has a special meaning behind it (meaning just one character or letter), it acts like a fill in the blank, in this example there are two fill in the blanks • touch -It will create an empty file, e.gtouch mynewfile • mkdir -It will create a directory ,e.gmkdir mydir32

  14. Tar files (tar) Creating and Extracting tar files To combine many files and directories into one folder Creating (-c creating a file, -f file name,-v “verbose”, verbose will display ongoing progress,-z zip a file) Extracting (-x extracting a file) Command Option End Result Target Folder tar -cf mybkdir24sep13.tar mybkdir24sep13 tar -cvf mybkdir24sep13.tar mybkdir24sep13 tar -czf mybkdir24sep13.tar.gz mybkdir24sep13 Command Option Target Folder tar -xf mybkdir24sep13.tar tar -xvf mybkdir24sep13.tar tar -xzf mybkdir24sep13.tar.gz

  15. Working with file editors Pico Name of the editor command to open screen shot • Pico file editor picomyfile CTRL X to exit

  16. Working with file editors vi Name of the editor command to open screen shot • vi file editor vi myfile :q to quit :w to save :wq to save and exit • I -going to insert mode • Ecs -going to command mode

  17. Working with file editorsEmacs Name of the editor command to open screen shot • Emacs file editor emacsmyfile

  18. File permissions

  19. File permissions Giving file permissions to files and directories Command -option argument description chmod 777 myfileWill assign read, write and execute permissions to all owner, group and others (rwxrwxrwx) chmoda+rwxmyfilewill assing read, write and execute permissions to all owner, group and others (rwxrwxrwx) chmod g-rxmyfilewill retrieve write permissions from group(rwx-w-rwx chmod -R 644 root will assign read and write permissions to owner and read permissions to group and others , this permission will be effected on the directory as well as all the subdirectories and folders residing inside root (rw--r--)

  20. Creating and Deleting User Creating a User • useraddbilal Assigning a password to a User • passwdbilal ****** ****** Default new user settings • useradd -D [- options] [-g] [-s] Deleting a user add users home directory as well • userdel –r bilal ‘-r’/home/bilal

More Related