LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-11-2014, 09:32 PM   #1
brianmay27
Member
 
Registered: Apr 2006
Posts: 74

Rep: Reputation: 15
cd into folder with name ".."


Hey all,

Im taking a network security class and we are trying to find exploits but Im having trouble cd into a folder with a name of ".." (two periods) It is an actual folder and an ls -al in the directory shows a . .. and another .. highlighted in green. Im stuck figuring out how to prevent it from taking .. as a parent command.

Any help would be great
 
Old 04-11-2014, 09:58 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
The cd command doesn't interpret ".." as a command; the ".." directory is a real directory link that leads to the parent directory.

If a second directory shows up as ".." in the directory listing, the name must be different somehow; a leading or trailing space, a non-printable character somewhere in the name, or one or both dots could be another character entirely, but one that looks similar to the punctuation mark.

You could try processing the directory with a "for" or "while" loop, or try using the autocomplete feature of the shell. If all else fails, run fsck on the file system to rule out a file system error.
 
Old 04-11-2014, 10:06 PM   #3
brianmay27
Member
 
Registered: Apr 2006
Posts: 74

Original Poster
Rep: Reputation: 15
Yeah you are right, I did a ls -alb and the folder is now ..\ still can not rename it or cd into it
 
Old 04-11-2014, 11:16 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
I'm confused.

.. is the current directory.

The filesystem shouldn't have allowed .. as a file name or directory name. (am I wrong on that? questions himself)
 
Old 04-11-2014, 11:21 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,333
Blog Entries: 12

Rep: Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729Reputation: 2729
If I remember correctly, . is the current directory and .. is the parent directory.

And jefro nailed it.

Code:
$ mkdir ..
mkdir: cannot create directory ‘..’: File exists
 
Old 04-11-2014, 11:24 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
The filesystem shouldn't have allowed .. as a file name or directory name. (am I wrong on that? questions himself)
And it hasn't. As the last post by the OP indicates, there's a non-printable character after the dots. Could be a space, could be something else entirely.
 
Old 04-11-2014, 11:26 PM   #7
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Quote:
Originally Posted by brianmay27 View Post
Yeah you are right, I did a ls -alb and the folder is now ..\ still can not rename it or cd into it
You could try:
Code:
cd ".. "
That will work if the extra character is a regular space. If that doesn't work, try typing
Code:
cd ..\
...and press tab to have the shell autocomplete the directory name.
 
Old 04-12-2014, 04:55 AM   #8
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,687

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Quote:
Originally Posted by Ser Olmy View Post
You could try:
Code:
cd ".. "
That will work if the extra character is a regular space. If that doesn't work, try typing
Code:
cd ..\
...and press tab to have the shell autocomplete the directory name.
The ls command has options to deal with funny characters in filenames: -b and -N. Try them to see the true name of this directory.

You can also do "vi ." to get a better view of the filename.
 
Old 04-12-2014, 10:04 AM   #9
brianmay27
Member
 
Registered: Apr 2006
Posts: 74

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by berndbausch View Post
The ls command has options to deal with funny characters in filenames: -b and -N. Try them to see the true name of this directory.

You can also do "vi ." to get a better view of the filename.
Ahh the vi command helped. And to my stupidity, it was not a folder but a file. Using vi I was able to open it from the parent directory.

Thanks everyone for the help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] There is no "menu.lst" in my Ubuntu "/boot/grub/" folder. msbstar Linux - Newbie 18 09-15-2012 02:26 PM
How to force "configure" and "Makefile" to look for dependencies in non sys folder? Dstruct0 Linux - Software 2 04-05-2011 09:01 AM
How does one "zip" a folder with Linux .? How does Windows user "unzip" same ? brjoon1021 Linux - Software 5 12-19-2010 01:10 AM
BASH:find out if volume "foo"/folder "goo" can be written to SilversleevesX Programming 2 08-28-2010 11:03 AM
After installing XAMPP for linux i have seen the folder "htdocs" belongs to "nobody". tirengarfio Linux - General 6 03-17-2010 02:41 PM


All times are GMT -5. The time now is 03:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration