User Tools

Site Tools


user:adahmane:portfolio:unixproject2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
user:adahmane:portfolio:unixproject2 [2013/08/25 16:33] – external edit 127.0.0.1user:adahmane:portfolio:unixproject2 [2013/12/11 19:55] (current) adahmane
Line 1: Line 1:
 +======Case Study 0x2: Unconventional Naming======
 +The second case study in the greatest class I will ever take. I will learn how to work with difficultly named files!
  
 +=====Objectives=====
 +Learn how to give commands with poorly named files. I will finish this case study with the knowledge required to call up files with spaces, odd characters, etc.
 +
 +=====Procedure=====
 +<cli>
 +lab46:~/Documents/badname$ ls
 +challenge  example  exercise
 +lab46:~/Documents/badname$ ls -la example/
 +total 4
 +drwxr-x--- 2 adahmane lab46 28 Feb 10  2004 .
 +drwxr-x--- 5 adahmane lab46 51 Sep 17  2010 ..
 +-rw-r----- 1 adahmane lab46 39 Dec  2  2001 look at me.text
 +lab46:~/Documents/badname$ ls -la exe     
 +ls: cannot access exe: No such file or directory
 +lab46:~/Documents/badname$ ls -la exercise/
 +total 44
 +-rw-r----- 1 adahmane lab46   43 Feb 10  2004 #pico28903#
 +-rw-r----- 1 adahmane lab46   28 Feb 10  2004 $USER VALUE$
 +-rw-r----- 1 adahmane lab46   23 Feb 10  2004 ( parenthesis & other odd things )
 +-rw-r----- 1 adahmane lab46   72 Feb 10  2004 *** watch out! ***
 +drwxr-x--- 2 adahmane lab46 4096 Feb 10  2004 .
 +drwxr-x--- 5 adahmane lab46   51 Sep 17  2010 ..
 +-rw-r----- 1 adahmane lab46   42 Dec  2  2001 ??? can you delete me ???.abc
 +-rw-r----- 1 adahmane lab46   35 Feb 10  2004 `ls` * HI! *
 +-rw-r----- 1 adahmane lab46   50 Dec  2  2001 change my\ name.file
 +-rw-r----- 1 adahmane lab46   52 Dec  2  2001 compress "this" file.data
 +-rw-r----- 1 adahmane lab46   40 Feb 10  2004 just a simple file.txt
 +-rw-r----- 1 adahmane lab46   46 Feb 10  2004 one, 'two', three, "four"
 +lab46:~/Documents/badname$ ls -la challenge/
 +total 4
 +-rw-r----- 1 adahmane lab46 56 Dec 16  2001 - challenge round -
 +drwxr-x--- 2 adahmane lab46 32 Sep 28  2012 .
 +drwxr-x--- 5 adahmane lab46 51 Sep 17  2010 ..
 +</cli>
 +
 +Below are the files I decided to cat using the wildcards learned in the case study...
 +
 +Using the * wildcard:
 +<cli>
 +lab46:~/Documents/badname/exercise$ cat comp*
 +this file has spaces and double quotes in its name.
 +lab46:~/Documents/badname/exercise$ cat one*
 +spaces, commas, two types of quotes... oh my!
 +lab46:~/Documents/badname/exercise$ cat change*
 +This file has spaces and a backslash in its name.
 +</cli>
 +
 +Using the \ escape character:
 +<cli>
 +lab46:~/Documents/badname/exercise$ cat \#pico28903# 
 +laLAA... pretend this is a pico temp file.
 +lab46:~/Documents/badname/exercise$ cat \*\*\*\ watch\ out\!\ \*\*\* 
 +Care must be taken when using the '!' symbol, as it deals with history.
 +lab46:~/Documents/badname/exercise$ cat \?\?\?\ can\ you\ delete\ me\ \?\?\?.abc 
 +This file has spaces and ?'s in its name.
 +</cli>
 +
 +Using the shell quoting facilities:
 +<cli>
 +lab46:~/Documents/badname/exercise$ cat "just a simple file.txt" 
 +Simple, but simpler without the spaces!
 +lab46:~/Documents/badname/exercise$ cat "( parenthesis & other odd things )" 
 +Are we having fun yet?
 +lab46:~/Documents/badname/exercise$ cat "??? can you delete me ???.abc" 
 +This file has spaces and ?'s in its name.
 +</cli>
 +
 +I had to use the man to figure out the last one:
 +<cli>
 +lab46:~/Documents/badname/challenge$ man rm
 +lab46:~/Documents/badname/challenge$ rm -- -\ challenge\ round\ - 
 +rm: remove regular file `- challenge round -'? yes
 +lab46:~/Documents/badname/challenge$ ls
 +</cli>