#Lesson3 contents: #TO mail someone a file use the "mail" command follow by the user's email address #Remember to redirect "<" to the file as follow: mail rserna2 < .alias #To find any file with EXCATLY 100 bytes use the "find" command with the option #"-size n" where "n" is the size of the file, follow by the letter "c". Note #that this will find ALL files that has exactly 100 bytes. find -name "*.ksh" -size 100c -print #To find ALL files that has more than 100 bytes, use "-size +n: where n=number of #bytes follow by the character "c" as follow: find . -name "*.ksh" -size +100c -print #To find ALL files that has less than 100 bytes, use "-size -n: where n=number of #bytes follow by the character "c" as follow: find . -name "*.ksh" -size -100c -print #To find out all the users who logged on to the subnet 130.182.166.* do as follow: who |grep "130.182.168.*" #To find out how many users who logged on to the subnet 130.182.166.* do as follow: who |grep "130.182.168.*" | wc -l #TO create a email file with the email addresses of all users who logged on to the #subnet 130.182.168.*, do as follow: who |grep "130.180.168.*"|awk '{print $1 "@calstatela.edu"}' > cs345F03.txt #TO create a email file, WITHOUT any DUPLICATE, with the email addresses of all #users who logged on to the subnet 130.182.168.*, do as follow: who |grep "130.182.168.*"|awk '{print $1 "@calstatela.edu"}' | sort -u > cs345F.txt #To ftp from the command prompt, use the command "ftp" follow by the server's name as #follow: ftp neptune.calstatela.edu #Some commonly used FTP commands: (Make sure that you are in FTP mode NOT Unix mode) # help : To display all ftp commands. # dir : display the contents of the current directory. # cd : change directory # hash : display the download/upload status. (this FTP-command has to be issued# BEFORE the "mget" or "mput" command. # mget : to download a file(s) to the current directory. (whereever you are # when you issue the ftp command is your downloading directory. # mput : to upload a file(s) to the directory of your ftp directory. # quit : quit the ftp mode. # binary : to download/upload a non text file. This command has to be issued # BEFORE the mget/mput command. #To use the awk command to operate on a csv file (comma seperated variable) we use #the AWK command with the option -F follow IMMEDIATELY by the field seperator (in #this case it is a comma) as follow: awk -F, '{print $2}' Orders.csv #To obtain a desired date format use the "date" command with the "+" option follow #by these choices: "%m" for month, "%d" for date and "%y" for year. date '+ %m/%d/%y' #This will give us: 10/11/03