Basic unix command help plz


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Basic unix command help plz
# 1  
Old 03-12-2008
Basic unix command help plz

I was wondering what command lines i could use to do the following.

1. mail a file to a user with a subject line "HELLO". Also, send a Blind carbon copy to a different user?

2. Display the number of files AND directories in a given directory?

3. Display the last 5 files in a given directory?

I've searched all the manual pages i could possibly think of and i can't seem to find the answers to these. Thanks!
# 2  
Old 03-12-2008
Quote:
Originally Posted by tragic54
I was wondering what command lines i could use to do the following.

1. mail a file to a user with a subject line "HELLO". Also, send a Blind carbon copy to a different user?

2. Display the number of files AND directories in a given directory?

3. Display the last 5 files in a given directory?

I've searched all the manual pages i could possibly think of and i can't seem to find the answers to these. Thanks!
Have you missed these pages?

Code:
1. man mail

2. man ls, man wc

3. man tail

Regards
# 3  
Old 03-12-2008
this one

Quote:
Originally Posted by tragic54
I was wondering what command lines i could use to do the following.

1. mail a file to a user with a subject line "HELLO". Also, send a Blind carbon copy to a different user?

2. Display the number of files AND directories in a given directory?

3. Display the last 5 files in a given directory?

I've searched all the manual pages i could possibly think of and i can't seem to find the answers to these. Thanks!

1.) mailx -s Hello to.person1@mail.com to.person2@mail.com < /path/file

Regards
# 4  
Old 03-12-2008
Quote:
Originally Posted by bdittmar
1.) mailx -s Hello to.person1@mail.com to.person2@mail.com < /path/file
wouldn't that just mail the file to both users?

I need to mail the file to one user, and in the same line send a blind carbon copy to a different user.
# 5  
Old 03-12-2008
Java

Quote:
Originally Posted by tragic54
I was wondering what command lines i could use to do the following.

1. mail a file to a user with a subject line "HELLO". Also, send a Blind carbon copy to a different user?

2. Display the number of files AND directories in a given directory?

3. Display the last 5 files in a given directory?

I've searched all the manual pages i could possibly think of and i can't seem to find the answers to these. Thanks!
Ans(Q1) :
mail -s HELLO person1@domain.com -b person2@domain.com <file.txt
(This will send the contents of the file as mail contents to person1 and blind carbon copies to person2)

uuencode file.txt file.txt | mail -s HELLO person1@domain.com -b person2@domain.com
(this will send the file as attachement to person1 and blind carbon copy to person2.Attachment can be send if and only if the file is encoded)


Ans(Q2) :
ls -Rl | awk 'BEGIN{d=0;f=0;l=0;}{if(/^d/){d++}else if(/^-/){f++}else if(/^l/){l++}}END{print "Directories: "d "\nFiles: " f "\nLinks: " l}'

Ans(Q3) :
ls | tail -5
(List the last five files in a directory)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Basic Unix cp command help

I am new to unix so this is probably a pretty basic question. I am trying to write several commands on one line that creates a directory called bf in the current directory, then copy all files within that directory and any subdirectories, that do not start with the letter c to the new bf folder.... (5 Replies)
Discussion started by: scotty85
5 Replies

2. UNIX for Dummies Questions & Answers

Need help with SED command plz

I need two solutions 1) How can i swap the first and last character in each line of file temp 2) How can i display content of the file using sed command Please help (2 Replies)
Discussion started by: champu
2 Replies

3. UNIX for Dummies Questions & Answers

plz help deliverable unix masters

i have two requirement a file1 has field CNT=1000 i want to take count on file2 which can be like 2000 and replace in file1 so it becomes CNT=2000 a file1 has field TSTMP=2008-11-06-15.54.20.000000 i want to take the file creation date on file2 which can be like... (1 Reply)
Discussion started by: er_zeeshan05
1 Replies

4. Shell Programming and Scripting

Very New To Unix Shell Programming:Plz Help

Hi Gurus I am very new to Unix Shell Prog. I have a file in format Q1 Dirname-FileName Score Remarks i.e. containing columns separated by space. I want to read Column 1 and 2 and then join them to make a string that would be a path to a file. I will use this string to fetch the files and... (4 Replies)
Discussion started by: kimskams80
4 Replies

5. UNIX for Dummies Questions & Answers

unix script plz help

cdfcxvvbbvnbjmjnhjml. (1 Reply)
Discussion started by: sree11
1 Replies

6. UNIX for Dummies Questions & Answers

explain command plz

echo -n "1. Updating Password Policy in OID..." | tee -a $logfile set ldap_v1 = `ldapsearch -b "" -h $oid_host -p $oid_port -D "cn=orcladmin" -w $admin_pwd -s sub "cn=PwdPolicyEntry" dn | head -1` echo "dn:$ldap_v1" > ldap1.out echo "changetype:modify" >> ldap1.out echo... (2 Replies)
Discussion started by: maoro
2 Replies

7. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

8. Shell Programming and Scripting

basic unix file command!

Hi there, I am looking to create a single file called outputa.txt, which will show the contents of my directorya and its sub directories, and all file and directory permissions. What command would be used for this? Cheers Kev (2 Replies)
Discussion started by: kev112
2 Replies

9. Tips and Tutorials

Unix Basic Command

A at : execute commands at a specified time/date. awk: a scripting language, especially useful for manipulating text and automation. B bash : invokes the Bourne Again Shell (standard on most boxes). batch: execute comands when load permits. bc : interactive C-like calcultor (integers... (6 Replies)
Discussion started by: binhnx2000
6 Replies

10. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
Login or Register to Ask a Question