Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Nitasha Gupta/Hive_Assignment_6.html

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Nitasha Gupta/Linux and Python Assignment/assignment_aws_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
AWS Assignment 1

1) How to access an instance if PEM file is lost?
Sol:
An ec2 instance can be accessed using another instance in same region and VPC by following steps:
1. First, create a new instance by creating new access file, call it 'helper' instance with same region and VPC as of the lost pem file instance.
2. Now stop the lost pem file instance. Remember not to terminate instance but to stop it.
3. Go to EBS volumes, select the root volume of the lost pem file instance and detach.
4. Now again select the detached volume and this time you have to attach this volume to helper instance which we created before. Since helper instance already has a root volume by default as /dev/sda1, the newly attached volume will be secondary (eg: /dev/sdf).
5. Login to your helper instance with its pem file.
6. Execute below commands:
a. # mount /dev/xvdf1 /mnt
b. # cp /root/.ssh/authorized_keys /mnt/root/.ssh/
c. # umount /mnt
7. Detach the secondary volume from helper instance.
8. Again, attach the volume back to our recovery instance. Start the instance. Terminate the helper instance.

23 changes: 23 additions & 0 deletions Nitasha Gupta/Linux and Python Assignment/assignment_lecture_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
1. When we create a user, some hidden files are generated in the directory of the same user at that time. How is it done?
Sol. The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd
program.
Several user configuration files are placed in /etc/skel by default when the operating system is installed. Typically they might include .bash_profile, .bashrc,
.bash_logout, dircolors, .inputrc and .vimrc.
The Home Directory has the following hidden files:
->System Settings:
->Configuration files
->User Profiles
->Desktop Environment Settings
->Application Configuration Profiles:
->Configuration files for applications
->Web browser data
->Caches
->Logs

2. Make sub directories inside a parent directory by using single mkdir command:
Sol. mkdir -p A/B/C

3. Why user folder is not created in by using useradd command?
Sol. When a user is created using useradd command, no shell is allocated to that user, so for the folder of the user to be created, one need to first create user
using useradd and the after assigning a password by in the /etc/passwd file.

24 changes: 24 additions & 0 deletions Nitasha Gupta/Linux and Python Assignment/assignment_lecture_4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1. Change the Umask value for any user permanently.
Sol. In order the change the umask value permanently, one has to change the values in config files. For Ubuntu change the umask value in file /etc/login.defs

2. How to add a new user without using adduser or useradd command?
Sol.
a. Add an entry in /etc/passwd as follows:
Username:password:UID:GID:Comments:Home_Directory:Login Shell
b. Create a Group with same name, i.e. add an entry in /etc/group
c. Assign a password to user by -> #passwd <user_name>
d. mkdir /home/<user_name>
e. chown user:user /home/user
f. copy contents from /etc/skel directory inside the home directory of the user.

3. Can we change the Umask value to 0888?
Sol. No, as it exceeds the octal value (i.e. 0-7) for each field (i.e. owner, group, others) as max permission that can be given is 7 (i.e. 111 in binary = 7 in decimal)

4. How to add new user with a unique user id e.g. 1345?
Sol. By using the -u/--uid option, i.e. useradd -u 1345 username

5. How to change group of any directory?
Sol. Groupid of any directory/file can be changed using:
chgrp <groupname>/+<groupid> <filename>
a) The Group name of the files inside the directory remains the same
b) To change group of all the files included in the directory, -R option is used to perform the action recursively.
12 changes: 12 additions & 0 deletions Nitasha Gupta/Linux and Python Assignment/assignment_lecture_5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
1. Create new user and at the same time you have to add the user into group
Sol. By command: useradd -G groupname username

2. How to unzip the bz2 file?
Sol. By command : bzip2 -d filename.bz2 (-d option is for decompressing)

3. Create archive+compressed file with extension bz2 and in that include some file with data&folder
Sol. By command: tar -cfvj archive.tar.bz2 file1 file2

4. Add user and at the same time change the shell of the user to /bin/sh
Sol. By command: useradd -s /bin/sh username

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Linux Assignment Lecture 6

1. What is 'd' in yum install command?
Sol. The d means "download only" which will download to /var/cache/yum/arch/prod/repo/packages/, but won�t install them.

2. Difference between rpm -e and yum remove.
Sol. YUM remove can remove rpm packages, but it will only remove the rpm package requested and not anything that package depends on. This is because if you follow the dependencies on removal, you'll end up removing something like libc, or the kernel, which you'd probably rather keep.
While rpm -e command, reviews the RPM database to find every file listed as being part of the package, and if they do not belong to another package, deletes them. It also checks the RPM database to make sure that no other packages depend on the package being erased and it executes a pre/post-uninstall script (if one exists).
29 changes: 29 additions & 0 deletions Nitasha Gupta/Linux and Python Assignment/assignment_python_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
1. What is cpython and jpython?
Sol.
a. Cpython:
Its the widely used interpreter, developed in C and python. Its uses a Glopbal interpreter Lock (GIL) on each process thus python bytecode for a sing;e process is executed on a single thread.
This is not suitable for CPU intensive algorithms. The steps of compilations are as follows :
i) Decoding
ii) Tokenizing
iii) Parsing
iv) AST (Abstract syntax tree)
v) Compiling

b. Jpython
Its an implementation that has been designed for the seamless integration of python code over JVM, the advantage of this integration is that it provides an opportunity for amalgamation of popular scripting language like python to a vast library of the JVM.
It complies tfiles to .class extension. It's programs can inherit and run Java class and compile the code to byte code. Along with this Jython can be used to implement any Java-based packages especially desirable for creating solutions using Servlets, Swing, SWT, and AWT packages. It also uses the GIL like cpython.


2. Difference btw Python 2 and Python 3?
Sol. Differences:
i) Python 2 us more stable and transparent version while python 3 is designed to address the design flaws in the previous versions
ii) print-syntax is treated as a statement in python 2 while it explicitly treated as a funtion in python 3 which requires an extra pair of parenthesis.
iii) ASCII string types is used to store the string in python 2 while unicode is the implicit string type in python 3
iv) On dividing two integers, python 2 simply returns nearest whole number while in python 3 the division is more intuitive using true division for integers and floats
v) In python 2 raw_input() and input() was used to take inputs while in python 3 only input() function is used.

3. Difference btw ASCII and Unicode?
Sol. Difference:
i) ASCII defines 128 characters, which maps to the numbers 0�127 while unicode defines (less than) 221 characters, which, similarly, map to numbers 0�221.
ii) Unicode is a superset of ASCII, and the numbers 0�127 have the same meaning in ASCII as they have in Unicode. For example, the number 65 means "Latin capital 'A'".
iii) Because Unicode characters don't generally fit into one 8-bit byte, there are numerous ways of storing Unicode characters in byte sequences, such as UTF-32 and UTF-8.
Loading