Linux

Linux


Need to use gmail to set up google account with a credit card


https://cloud.google.com/




What is an Operating System?


An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.

 

Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources.

 

Linux began in 1991 as a personal project by Finnish student Linus Torvalds: to create a new free operating system kernel. The resulting Linux kernel has been marked by constant growth throughout its history.

 

The Unix operating system was conceived and implemented by Ken Thompson and Dennis Ritchie (both of AT&T Bell Laboratories) in 1969 and first released in 1970. 

Programming language, C, to make it portable. 

 

In 1977, the Berkeley Software Distribution (BSD) was developed by the Computer Systems Research Group (CSRG) from UC Berkeley, based on the 6th edition of Unix from AT&T.

 

In 1983, Richard Stallman started the GNU project with the goal of creating a free UNIX-like operating system.[7] As part of this work, he wrote the GNU General Public License (GPL). By the early 1990s, there was almost enough available software to create a full operating system. 

In 1985, Intel released the 80386, the first x86 microprocessor with a 32-bit instruction set and a memory management unit with paging.[8]D.

 

 

 

 

The Operating System boots or brings up a kernel 

 

Linux is an operating system that allows users to control computers

 

Open source - 

  • denoting software for which the original source code is made freely available and may be redistributed and modified.

 

Free - (for the most part)

 

When you login to a Linux system 

 

Access the Cloud Shell

 

Click on symbol for access to Linux Shell

 

User name                               Host name                                                    prompt

 

john_iacovacci1@cloudshell:~ (uconn-engr)$

 

Ctrl +c will always get prompt back

 

You can access the system via ssh or putty (on Windows)


these tools allow for terminal emulation (emulate a terminal


as if it were physically connected to the machine


Google provides access to a Linux Shell by clicking on




 

>_ icon in the upper right hand part of the screen

 

 

All Linux/Unix system have a superuser account called "root"

 

This account can change passwords, delete files and do everything on the system. Full permissions.

 

Linux is case sensitive and do not use spaces in file names


A file system is necessary to store files on a computer


The Linux file system starts with the root directory (like a tree)


and branches into subdirectories from the root.


Each sub-directory can have move subdirectories underneath so it is like an upside down tree.


Linux File System Directories

/bin: Where Linux core commands reside like ls, mv.

/boot: Where boot loader and boot files are located.

/dev: Where all physical drives are mounted like USBs DVDs.

/etc: Contains configurations for the installed packages.

/home: Where every user will have a personal folder to put his folders with his name like /home/john_iacovacci1 (taken from my gmail login)

/lib: Where the libraries of the installed packages located since libraries shared among all packages

/root: The home folder for the root user.

/sbin: Like /bin, but binaries here are for root user only.

/tmp: Contains the temporary files.

/usr: Where the utilities and files shared between users on Linux.

/var: Contains system logs and other variable data.

The navigation commands

cd - is change directory

you can change directory to an absolute path e.g.

cd /home/john_iacovacci1

 

absolute path always begins with /

or relative path to where you currently are set to

cd docs (a directory under /home/john_iacovacci1)

 

Note: cd $HOME

 

will take you to your home directory

 

john_iacovacci1@cloudshell:~ (uconn-engr)$ cd $HOME

john_iacovacci1@cloudshell:~ (uconn-engr)$ pwd

/home/john_iacovacci1

john_iacovacci1@cloudshell:~ (uconn-engr)$

 

john_iacovacci1@cloudshell:~ (uconn-engr)$ cd docs

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ pwd

/home/john_iacovacci1/docs

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

pwd - stands for print working directory - tells you where you are

ls - lists all files and directories within the working directory (or path you provided)

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls

file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

linux files have 3 sets of permission attributes

read(r), write(w) and execute(x) for owner, group and everyone

 

adding the -lt option for (for ownership and time stamp)

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls -lt

total 4

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:24 file1

 

I can now see how the file is permissioned

 

the chmod command can change the permissions of a file or directory

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ chmod +x file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls -lt

total 8

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:37 file2

-rwxr-xr-x 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:24 file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

to create a directory you use the mkdir command

 

john_iacovacci1@cloudshell:~ (uconn-engr)$ mkdir images

john_iacovacci1@cloudshell:~ (uconn-engr)$ cd images

john_iacovacci1@cloudshell:~/images (uconn-engr)$

john_iacovacci1@cloudshell:~/docs$ touch file1

to copy a file use the cp command

john_iacovacci1@cloudshell:~/docs$ cp file1 file2

john_iacovacci1@cloudshell:~/docs$ ls -lt

total 20

-rwxr-xr-x 1 john_iacovacci1 rvm             20 Sep  1 22:48 file2

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1  0 Sep  1 22:46 file

-rw-r--r-- 1 john_iacovacci1 rvm             14 Sep  1 22:46 first

-rwxr-xr-x 1 john_iacovacci1 rvm             20 Sep  1 22:46 file1

-rw-r--r-- 1 john_iacovacci1 rvm             12 Jan 28  2020 file4

-rw-r--r-- 1 john_iacovacci1 rvm             12 Jan 27  2020 file3

john_iacovacci1@cloudshell:~/docs$

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ cp file1 file2

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls -lt

total 8

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:37 file2

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:24 file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

a wildcard allows you to use any command to pattern match to a file

 

? - one character

* - all characters 

[] - range of characters

 

ls -lt file?

ls -lt f*

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls -lt file?

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:37 file2

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:24 file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ ls -lt f*

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:37 file2

-rw-r--r-- 1 john_iacovacci1 john_iacovacci1 13 Jan 26 21:24 file1

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

pico is an editor to help create of change files

 

cat is a command that display contents to a file

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ cat file1

test doc one

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

echo is a command to repeat what you type

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ echo "hello world"

hello world

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

redirection and pipes

 

redirection allows you to redirect output to a file

 

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ echo "hello world" > file3

john_iacovacci1@cloudshell:~/docs (uconn-engr)$ cat file3

hello world

john_iacovacci1@cloudshell:~/docs (uconn-engr)$

 

other file commands are

 

rm - remove a file

mv - move a file

mkdir - make directory

rmdir - remove directory

pwd — print working directory,

know which directory you are in, absolute path e.g. "/home/username".

ls — Use the "ls" files are in the directory you are in. ls -lt 

touch — command is used to create a file.

man --help — how to use command manual pages "man cd”

cp — copy files through the command line.

mv — move files 

locate — locate a file in a Linux system

echo — repeats what you type.

cat — display contents of a file.

nano, vi, jed, pico - edit files

sudo — super user do allows you to act as root use.

df — see the available disk space 

du — know the disk usage of a file in your system.

tar — work with compressed files

zip, unzip — compress files into a zip and unzip files

chmod — change the permissions granted to it in Linux.

hostname — know your name in your host or network.

“hostname -I” gives you your IP address in your network.

ping — Use ping to check your connection to a server. 

clear - clear the terminal


 

TAB can be used to fill up in terminal.


Ctrl+C can be used to stop any command


exit terminal by using the exit command.

 

Pico (Pine composer) is a text editor for Unix and Unix-based computer systems. It is integrated with the Pine e-mail client, which was designed by the Office of Computing and Communications at the University of Washington.[1]

From the Pine FAQ: "Pine's message composition editor is also available as a separate stand-alone program, called PICO. PICO is a very simple and easy-to-use text editor offering paragraph justification, cut/paste, and a spelling checker...".

 

pico editor

 

man ls  

 

man - manual for all linux commands

 

 

Assignment one - create a directory under your home directory called scripts and create a file called my_profile

 

 

1. pwd

 

should be home/user_name

 

2. mkdir scripts

 

3. cd scripts

 

4. pwd - /home/user_name/scripts

 

5. Use the terminal editor to access the graphical editor

 

6. Click into the directory

 

7. Open a New File

 

8. Name the file my_profile

 

9. Enter the commands into the file

10. Save the file

11. Go back to the Cloud Shell Terminal

12. Change the properties of the file so it can be executable

john_iacovacci1@cloudshell:~/scripts (uconn-engr)$ chmod 755 my_profile

 

13. Check the file status for executable

john_iacovacci1@cloudshell:~/scripts (uconn-engr)$ ls -lt

total 4

-rwxr-xr-x 1 john_iacovacci1 rvm 136 Sep  1 23:16 my_profile

14. Execute the script

john_iacovacci1@cloudshell:~/scripts (uconn-engr)$ ./my_profile

Hello my name is John Iacovacci

My major is Computer Science

I want to be a developer


No comments:

Post a Comment

Office hours tomorrow(Tuesday) 5:00pm-6:00pm, 4/26/2021, 5:13 PM, English, 4/26/2021, 5:13 PM

Your assigned language is: English Classroom blog: googleclouduconn.blogspot.com 4/26/2021, 5:13 PM Office hours tomorrow(Tuesday) 5...