Changing a file

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Changing a file
# 1  
Old 09-18-2011
Changing a file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

Make “hardlink” readable, writeable, executable by you, but not readable, writeable, executable by anyone else. What command did you use to do this?

We created a textfile with a hardlink.


2. Relevant commands, code, scripts, algorithms:

not sure, i was trying chmod and ln but i am not sure



3. The attempts at a solution (include all code and scripts):

I have been looking through the man pages but i dont know what it should do.



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Washington State University Pullman, WA US Bakken, cpts 224


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
# 2  
Old 09-18-2011
I am not sure what the question is.

ln does make links. chmod does change permissions. if you read each of their manual pages, you should be in the clear.

with chmod you can calculate the octal number representation, or go the easy way. If I'm just changing 1 permission set I use the easy way. It starts with any of "ugoa", for user, group, other, and all, respectively.

Here is example, output from my terminal:

Code:
[mute@geek ~/lilbo4231]$ touch file.txt
[mute@geek ~/lilbo4231]$ ln file.txt new.txt
[mute@geek ~/lilbo4231]$ ls -l
total 0
-rw-r--r-- 2 mute mute 0 Sep 19 02:37 file.txt
-rw-r--r-- 2 mute mute 0 Sep 19 02:37 new.txt
[mute@geek ~/lilbo4231]$ chmod u+rwx,go-rwx new.txt
[mute@geek ~/lilbo4231]$ ls -l
total 0
-rwx------ 2 mute mute 0 Sep 19 02:37 file.txt
-rwx------ 2 mute mute 0 Sep 19 02:37 new.txt
[mute@geek ~/lilbo4231]$

# 3  
Old 09-19-2011
if the drive is ACL Mounted then use setfacl ..
# 4  
Old 09-19-2011
Quote:
with chmod you can calculate the octal number representation, or go the easy way.
Octal IS the easy way.

Code:
ln 'sourcefile' 'yourfile'
chmod 700 yourfile

# 5  
Old 09-19-2011
Quote:
Originally Posted by Tommyk
Octal IS the easy way.
s/easy/mnemonic/ in my first post then. Smilie

Octal is easier once you learn that

Code:
 uuugggooo
 
-rwxrwxrwx  somefile.txt
 
 421421421

Then add... But I didn't care to give a lesson on numbers. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing file permissions of a file created by another user

Hi, I have used expdp for datapump. The .dmp file is created by the "oracle" user. my requirement is to make a zipped file of this .dmp file. What i am trying to do is change the permissions of this .dmp file from 0640 to 0644 and then do a gzip and zip it. Is there any way i can change... (3 Replies)
Discussion started by: qwertyu
3 Replies

2. Shell Programming and Scripting

changing a file when the inode modified time of the other file changes

i have a requirement where i needed to change variable values in a properties file(first file) whenever there is change to Release details file(second file). My question is do i have to create a daemon process that always checks the modified time/inode change of the second file and then change the... (1 Reply)
Discussion started by: saikiran_1984
1 Replies

3. UNIX for Dummies Questions & Answers

Changing file content based on file header

Hi, I have several text files each containing some data as shown below: File1.txt >DataHeader Data... Data... File2.txt >DataHeader Data... Data... etc. What I want is to change the 'DataHeader' based on the file name. So the output should look like: File1.txt >File1 ... (1 Reply)
Discussion started by: Fahmida
1 Replies

4. Shell Programming and Scripting

Changing Name of File

Write a shell program to replace the starting alphabet "a" with "k" for the file names in the current directory. Note : Change only the file names starting with "a". Rest of the file names remains unchanged. Homework. Replies deleted. Closed. (0 Replies)
Discussion started by: shashwat2691
0 Replies

5. Shell Programming and Scripting

changing csv file contents to file of rows

i have a file a.txt contents as 1,2,3,4,......etc...in a single line, i want to write to another file in rows as 1 2 3 4 5 can u help? i do not know the length of a.txt (4 Replies)
Discussion started by: pravfraz
4 Replies

6. Shell Programming and Scripting

changing line on a file

Hi, I want to change on a file this line: vif = into: vif = But there are some conditionals: 1. last part '] of the original line after 00:16:3E:CE:23:14' ] may vary to 00:16:3E:CE:23:14' ] or 00:16:3E:CE:23:14 ' ] 2. The second mac adrress of the line I need,... (4 Replies)
Discussion started by: iga3725
4 Replies

7. UNIX for Dummies Questions & Answers

Changing old file name to new one if the old file name satisfied certain condition

Hi guys, I desperately need your help on my problem:- I got a folder in my directory that has many files in it. Most of the file's name is starting with certain prefix. Eg: ABC, CDE, EFG, etc. I only want to change file name that is starting from certain prefix and the rest I want them to... (1 Reply)
Discussion started by: balzzz
1 Replies

8. UNIX for Dummies Questions & Answers

Changing the File Name

Dear all, I want to change all the File name in a folder from File1.txt to File1YYYYMMDD.txt where YYYYMMDD is the date of the file is renamed. I have used the following scripts:- ******************************************************** #!/bin/ksh A=`date +"%d%m%Y" for in * ... (2 Replies)
Discussion started by: balzzz
2 Replies

9. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

10. Shell Programming and Scripting

changing to a different file

Hi, At the moment, I have inserted an actual filename to conduct searches through it etc... Instead, I want the user to choose a filename and then do the searches against this file, instead of already having specified the file in the code. How would I do this? I tried doing the following, but it... (5 Replies)
Discussion started by: kev269
5 Replies
Login or Register to Ask a Question