Assignment 9 :  Linux  GUI  and  Commands
Upcoming SlideShare
Loading in...5
×
 

Assignment 9 : Linux GUI and Commands

on

  • 824 views

 

Statistics

Views

Total Views
824
Views on SlideShare
824
Embed Views
0

Actions

Likes
0
Downloads
13
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Assignment 9 :  Linux  GUI  and  Commands Assignment 9 : Linux GUI and Commands Document Transcript

  • 1. LINUX Linux is a computer operating system assembled under the model of free and open source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991, by Linus Torvalds. Since the C compiler that builds Linux and the main supporting user space system tools and libraries originated in the GNU Project, initiated in 1983 by Richard Stallman, the Free Software Foundation prefers the name GNU/Linux when these tools and libraries are used. Linux was originally developed as a free operating system for Intel x86-based personal computers. It has since been ported to more computer hardware platforms than any other operating system. It is a leading operating system on servers and other big iron systems such as mainframe computers and supercomputers: more than 90% of today's 500 fastest supercomputers run some variant of Linux, including the 10 fastest. Linux also runs on embedded systems (devices where the operating system is typically built into the firmware and highly tailored to the system) such as mobile phones, tablet computers, network routers, building automation controls, televisions and video game consoles; the Android system in wide use on mobile devices is built on the Linux kernel. The development of Linux is one of the most prominent examples of free and open source software collaboration: the underlying source code may be used, modified, and distributed— commercially or non-commercially—by anyone under licenses such as the GNU General Public License. Typically Linux is packaged in a format known as a Linux distribution for desktop and server use. Some popular mainstream Linux distributions include Debian (and its derivatives such as Ubuntu and Linux Mint), Fedora (and its derivatives such as the commercial Red Hat Enterprise Linux and its open equivalent CentOS), Mandriva/Mageia, openSUSE (and its commercial derivative SUSE Linux Enterprise Server), and Arch Linux. Linux distributions include the Linux kernel, supporting utilities and libraries and usually a large amount of application software to fulfil the distribution's intended use. A distribution oriented toward desktop use will typically include the X Window System and an accompanying desktop environment such as GNOME or KDE Plasma. Some such distributions may include a less resource intensive desktop such as LXDE or Xfce for use on older or less powerful computers. A distribution intended to run as a server may omit all graphical environments from the standard install and instead include other software such as the Apache HTTP Server and an SSH server such as OpenSSH. Because Linux is freely redistributable, anyone may create a distribution for any intended use. Applications commonly used with desktop Linux systems include the Mozilla Firefox web browser, the LibreOffice office application suite, and the GIMP image editor. Today, Linux systems are used in every domain, from embedded systems to supercomputers, and have secured a place in server installations often using the popular LAMP application stack. Use of Linux distributions in home and enterprise desktops has been growing. They have also gained popularity with various local and national governments. The federal
  • government of Brazil is well known for its support for Linux. News of the Russian military creating its own Linux distribution has also surfaced, and has come to fruition as the G.H.ost Project. The Indian state of Kerala has gone to the extent of mandating that all state high schools run Linux on their computers. China uses Linux exclusively as the operating system for its Loongson processor family to achieve technology independence. In Spain some regions have developed their own Linux distributions, which are widely used in education and official institutions, like gnuLinEx in Extremadura and Guadalinex in Andalusia. Portugal is also using its own Linux distribution Caixa Mágica, used in the Magalhães netbook and the e-escola government program. France and Germany have also taken steps toward the adoption of Linux. Linux distributions have also become popular in the netbook market, with many devices such as the ASUS Eee PC and Acer Aspire One shipping with customized Linux distributions installed. Torvalds continues to direct the development of the kernel. Stallman heads the Free Software Foundation, which in turn supports the GNU components. Finally, individuals and corporations develop third-party non-GNU components. These third-party components comprise a vast body of work and may include both kernel modules and user applications and libraries. Linux vendors and communities combine and distribute the kernel, GNU components, and non-GNU components, with additional package management software in the form of Linux distributions. 2. DESIGN A Linux-based system is a modular Unix-like operating system. It derives much of its basic design from principles established in Unix during the 1970s and 1980s. Such a system uses a monolithic kernel, the Linux kernel, which handles process control, networking, and peripheral and file system access. Device drivers are either integrated directly with the kernel or added as modules loaded while the system is running. Separate projects that interface with the kernel provide much of the system's higher-level functionality. The GNU userland is an important part of most Linux-based systems, providing the most common implementation of the C library, a popular shell, and many of the common Unix tools which carry out many basic operating system tasks. The graphical user interface (or GUI) used by most Linux systems is built on top of an implementation of the X Window System. Some components of an installed Linux system are:   A bootloader - for example GRUB or LILO. This is a program which is executed by the computer when it is first turned on, and loads the Linux kernel into memory. An init program. This is the first process launched by the Linux kernel, and is at the root of the process tree: in other terms, all processes are launched through init. It starts
  •   2.1. processes such as system services and login prompts (whether graphical or in terminal mode) Software libraries which contain code which can be used by running processes. On Linux systems using ELF-format executable files, the dynamic linker which manages use of dynamic libraries is "ld-linux.so". The most commonly used software library on Linux systems is the GNU C Library. If the system is set up for the user to compile software themselves, header files will also be included to describe the interface of installed libraries. User interface programs such as command shells or windowing environments USER INTERFACE The user interface, also known as the shell, is either a command-line interface (CLI), a graphical user interface (GUI), or through controls attached to the associated hardware, which is common for embedded systems. For desktop systems, the default mode is usually a graphical user interface, although the CLI is available through terminal emulator windows or on a separate virtual console. Most low-level Linux components, including the GNU userland, use the CLI exclusively. The CLI is particularly suited for automation of repetitive or delayed tasks, and provides very simple inter-process communication. On desktop systems, the most popular user interfaces are the extensive desktop environments KDE Plasma Desktop, GNOME, Cinnamon, Unity and Xfce, though a variety of additional user interfaces exist. Most popular user interfaces are based on the X Window System, often simply called "X". It provides network transparency and permits a graphical application running on one system to be displayed on another where a user may interact with the application. Other GUIs may be classified as simple X window managers, such as FVWM, Enlightenment, and Window Maker, which provide a minimalist functionality with respect to the desktop environments. A window manager provides a means to control the placement and appearance of individual application windows, and interacts with the X Window System. The desktop environments include window managers as part of their standard installations (Mutter for GNOME, KWin for KDE, Xfwm for Xfce as of January 2012) although users may choose to use a different window manager if preferred. 3. DEVELOPMENT  The primary difference between Linux and many other popular contemporary operating systems is that the Linux kernel and other components are free and open source software. Linux is not the only such operating system, although it is by far the most widely used.[60] Some free and open source software licenses are based on the principle of copyleft, a kind of reciprocity: any work derived from a copyleft piece of software must also be copyleft itself. The most common free software license, the GNU General Public License (GPL),
  •    is a form of copyleft, and is used for the Linux kernel and many of the components from the GNU Project. Linux based distributions are intended by developers for interoperability with other operating systems and established computing standards. Linux systems adhere to POSIX,[61] SUS,[62] LSB, ISO, and ANSI standards where possible, although to date only one Linux distribution has been POSIX.1 certified, Linux-FT.[63][64] Free software projects, although developed in a collaborative fashion, are often produced independently of each other. The fact that the software licenses explicitly permit redistribution, however, provides a basis for larger scale projects that collect the software produced by stand-alone projects and make it available all at once in the form of a Linux distribution. Many Linux distributions, or "distros", manage a remote collection of system software and application software packages available for download and installation through a network connection. This allows users to adapt the operating system to their specific needs. Distributions are maintained by individuals, loose-knit teams, volunteer organizations, and commercial entities. A distribution is responsible for the default configuration of the installed Linux kernel, general system security, and more generally integration of the different software packages into a coherent whole. Distributions typically use a package manager such as dpkg, Synaptic, YAST, yum, or Portage to install, remove and update all of a system's software from one central location. UBUNTU GRAPHICAL USER INTERFACE http://www.ubuntu.com/tour/en/ http://news.cnet.com/8301-13554_3-9985154-33.html
  • BASIC LINUX COMMANDS 1. Lists the contents of a directory / list files and directories in bare format where we won’t be able to view details ls ls ls ls ls ls ls ls -a -i -l -r -R -s -x Shows you all files, even files that are hidden (these files begin with a dot.) For each file, print the i-node number in the first column of the report. Shows - permissions, owners, size, and when last modified.) Reverses the order of how the files are displayed. Includes the contents of subdirectories. Give size in blocks, including indirect blocks, for each entry. Displays files in columns. Permissions Directories Group Size Date Directory or file drwx------ 2 users 4096 Nov 2 19:51 mail/ drwxr-s--- 35 www 32768 Jan 20 22:39 public_html/ -rw------- 1 users 3 Nov 25 02:58 test.txt Permissions - The permissions of the directory or file. Directories - The amount of links or directories within the directory. The default amount of directories is going to always be 2 because of the . and .. directories. Group - The group assigned to the file or directory Size - Size of the file or directory. Date - Date of last modification. Directory of file - The name of the file or file. 2. chmod Changes the permission of a file. / file or directory permissions. Following is a sample of ls -l command output. In this, the 9 characters from 2nd to 10th position represents the permissions for the 3 types of users. -rw-r--r-- 1 john john 272 Mar 17 08:22 test.txt Permissions u - User who owns the file. g - Group that owns the file. o - Other. a - All. r - Read the file. w - Write or edit the file. x - Execute or run the file as a program. 1. Add single permission to a file/directory Changing permission to a single set. + symbol means adding permission. For example, do the following to give execute permission for the user irrespective of anything else: 2. Add multiple permission to a file/directory Use comma to separate the multiple permission sets as shown below. $ chmod u+r,g+x filename
  • 3. Remove permission from a file/directory Following example removes read and write permission for the user. $ chmod u-rx filename 4. Change permission for all roles on a file/directory Following example assigns execute privilege to user, group and others (basically anybody can execute this file). $ chmod a+x filename 5. Make permission for a file same as another file (using reference) If you want to change a file permission same as another file, use the reference option as shown below. In this example, file2′s permission will be set exactly same as file1′s permission. $ chmod --reference=file1 file2 3. password Both Linux and UNIX use the passwd command to change user password. The passwd is used to update a user’s authentication token (password) stored in shadow file. A normal user may only change the password for his/her own account, the super user (or root) may change the password for any account. The administrator of a group may change the password for the group. passwd also changes account information, such as the full name of the user, user's login shell, or password expiry date and interval. Set or Change User Password Type passwd command as follows to change your own password: $ passwd Output: Changing password for vivek (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully 4. su su su alice Become super user or another user. The su (short for substitute user) command makes it possible to change a login session's owner (i.e., the user who originally created that session by logging on to the system) without the owner having to first log out of that session. The operating system assumes that, in the absence of a username, the user wants to change to a root session, and thus the user is prompted for the root password as soon as the ENTER key is pressed. This produces the same result as typing: su root Likewise, to transfer the ownership of a session to any other user, the name of that user is typed after su and a space. For example, to change the owner of the current login session to a user named alice, type the following:
  • su hope The name of the current user can also be confirmed by using the whoami command, i.e., whoami Login as the user hope as if the user hope actually logged in (process all login scripts 5. tty The Linux "tty" command display the name of the connected terminal or Print filename of terminal on stdin. A tty command in Linux and other Unix-like operating systems is a shell command that can be entered interactively or as part of a script to determine whether the output for the script is a terminal (that is, to an interactive user) or to some other destination such as another program or a printer. 6. who command As a Linux user, sometimes it is required to know some basic information like :    Time of last system boot List of users logged-in Current run level etc Though this type of information can be obtained from various files in the Linux system but there is a command line utility 'who' that does exactly the same for you. In this article, we will discuss the capabilities and features provided by the 'who' command. who - Get the information on currently logged in users syntax who [OPTION]... [ FILE | ARG1 ARG2 ] -b, --boot time of last system boot -m only hostname and user associated with stdin -q, --count all login names and number of users logged on -u, --users list users logged in --message
  • 7. make command make - GNU make utility to maintain groups of programs The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. The manual describes the GNU implementation of make, which was written by Richard Stallman and Roland McGrath. Our examples show C programs, since they are most common, but you can use make with any programming language whose compiler can be run with a shell command. In fact, make is not limited to programs. You can use it to describe any task where some files must be updated automatically from others whenever the others change. To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and the states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files. Once a suitable makefile exists, each time you change some source files, this simple shell command: make suffices to perform all necessary recompilations. The make program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the data base. make executes commands in the makefile to update one or more target names, where name is typically a program. If no -f option is present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order. Create the Makefile for a Simple Compilation Let us assume that you have the sample C program file called helloworld.c. Using cc command, typically you would compile it as shown below. $ cc -o helloworld helloworld.c While you don’t need to use make for compiling single a program, the following example will give you an idea on how to use make. Create a makefile as shown below. $ vim makefile helloworld : helloworld.c cc -o helloworld helloworld.c Execute make to create the helloworld executable as shown below. $ make helloworld (or)
  • $ make 8. rpm command RPM command is used for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Linux system. RPM stands for Red Hat Package Manager. There are five basic modes for RPM command 1. 2. 3. 4. 5. Install : It is used to install any RPM package. Remove : It is used to erase, remove or un-install any RPM package. Upgrade : It is used to update the existing RPM package. Verify : It is used to query about different RPM packages. Query : It is used for the verification of any RPM package. With root privilege, you can use the rpm command with appropriate options to manage the RPM software packages. In this article, let us review 15 practical examples of rpm command. Let us take an rpm of Mysql Client and run through all our examples. Syntax rpm - RPM Package Manager 9) yum command yum - Yellowdog Updater Modified yum is an interactive, automated update program which can be used for maintaining systems using rpm Syntax yum [options] [command] [package ...] The following are the ways which you can invoke yum in list mode. Note that all list commands include information on the version of the pack-
  • age. yum list [all | regexp1] [regexp2] [...] List all available and installed packages. yum list available [regexp1] [...] List all packages in the yum repositories installed. List available to be yum list updates [regexp1] [...] all packages with updates available in the yum repositories. yum list installed [regexp1] [...] List the packages specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed. yum list extras [regexp1] [...] List the packages installed on the system that are not available yum repository listed in the config file. in any yum list obsoletes [regexp1] [...] List the packages installed on the system that are obsolete by packages in any yum repository listed in the config file. yum list recent List packages recently added into the repositories. Specifying package names All the list options mentioned above take file-glob-syntax wild-cards or package names as arguments, for example yum list avail-able foo* will list all available packages that match foo*. 9) sudo command sudo - execute a command as another user / Allows a user with proper permissions to execute a command as the superuser or other user. sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file. The real and effective uid and gid are set to match those of the target user as specified in the passwd file (the group vector is also initialized when the target user is not root). By default, sudo requires that users authenticate themselves with a password (NOTE: by default this is the user's password, not the root password). Once a user has been authenticated, a timestamp is
  • updated and the user may then use sudo without a password for a short period of time (5 minutes unless overridden in sudoers). The sudo command stands for "superuser do". It prompts you for your personal password and confirms your request to execute a command by checking a file, called sudoers, which the system administrator configures. Using the sudoers file, system administrators can give certain users or groups access to some or all commands without those users having to know the root password. It also logs all commands and arguments so there is a record of who used it for what, and when. To use the sudo command, at the command prompt, enter: sudo command Replace command with the command for which you want to use sudo. The sudo command also makes it easier to practice the principle of least privilege (PoLP), which is a computer security concept that helps control system access and potential system exploits and compromises. For more information about the sudo command, Examples su -u hope ls ~hope List the contents of the hope directory as the hope user. 10) shutdown -- command shutdown - bring the system down or Turn off the computer immediately or at a specified time. shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay. All processes are first notified that the system is going down by the signal SIGTERM. This gives programs like vi(1) the time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc. shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown. To see which actions are taken on halt or reboot see the appropriate entries for these runlevels in the file /etc/inittab.
  • Syntax shutdown [-a][-t sec][-krhnfFc][time][warning-message] -a -t sec -k -r -h -n -f -F -c time warningmessage Use /etc/shutdown.allow. Tell init to wait sec seconds between sending processes the warning and the kill signal, before changing to another runlevel. Don't really shutdown; only send the warning messages to everybody. Reboot after shutdown. Halt after shutdown. Don't call init to do the shutdown but do it ourselves. The use of this option is discouraged, and its results are not always what you'd expect. Skip fsck on reboot. Force fsck on reboot. Cancel an already running shutdown. With this option it is of course not possible to give the time argument, but you can enter an explanatory message on the command line that will be sent to all users. When to shutdown. Message to send to all users. Examples shutdown 8:00 Shutdown the computer at 8-oclock *** *** ***