Cygwin unexpected token `(' on cd - cygwin

I have got Program Files and Program Files (x86) directory at C. I can access to Program Files using $ cd Program\ Files\ from windows 8 but this $ cd Program\ Files\ (x86) command returns following error:
sadaf2605#Sadaf /cygdrive/c
$ cd Program\ Files\ (x86)
-bash: syntax error near unexpected token `('

You have to escape the parentheses as well:
$ cd Program\ Files\ \(x86\)
Or just use quotes:
$ cd "Program Files (x86)"

Related

Cannot open directory in Linux, but I can absolutely 'ls' to show it up

I'm using "Web Terminal"
My tree files: /li/modules/
Show path:
[cloud_user#f9c89e938e1c modules]$ pwd
/lib/modules
Get list:
[cloud_user#f9c89e938e1c modules]$ ls
3.10.0-1127.10.1.el7.x86_64 3.10.0-1127.18.2.el7.x86_64 3.10.0-1127.19.1.el7.x86_64 3.10.0-1127.8.2.el7.x86_64 3.10.0-1160.15.2.el7.x86_64
The last one 3.10.0-1160.15.2.el7.x86_64 have already exist.
So, why this command do not work:
[cloud_user#f9c89e938e1c modules]$ cd /li/modules/3.10.0-1160.15.2.el7.x86_64
-bash: cd: /li/modules/3.10.0-1160.15.2.el7.x86_64: No such file or directory
or (same):
cd /lib/modules/`uname -r`/
Would you tell me what exactly "No such file or directory" means? Thanks a lot!

command l to access downloads directory in raspian

lines I have tried:
cd ~/downloads
cd /home/pi/downloads
cd ~/user/home/downloads
ls ~/downloads
cd ~./downloads
If I use the nano command the screen will come up but if Try to change directory it says "no such file or directory". Don't laugh its probably simple but I'm new to Linux and trying to learn command lines.

cygwin extracting to another directory

I have a file, in Windows, called php_0.27.tar.gz and want to extract it to C:\Program Files\PHP\script through Cygwin using this command:
tar -xf php_0.27.tar.gz -C /Program Files/PHP/script
But I got an error saying:
tar: Files: Not found in archive
I tried this command too:
tar -xf php_.tar.gz --directory /Program Files/PHP/script
But I got an other error saying:
tar: php_0.27.tar.gz: Cannot open: No such file or directory
So I tried:
tar -xf php_.tar.gz --directory C:/Program Files/PHP/script
But I failed and now I am stuck. I need help
The space in the directory name Program Files is the source of the error ; putting the whole path to directory between quotes like this "C:/Program Files/PHP/script" solve the problem

/cygdrive path is broken

My cygwin used to work properly before, but suddenly it starts to complain: "file does not exist" under /cygdrive/d ...
The problem looks like this: if I cd to that folder I can saw that file and cat/ls afile without any problem, but if I use something like ls /cygdrive/d/afile it will complain "file does not exist".
So I traced backwards on the file system, and found there's some issue with the virtual path /cygdrive
/cygdrive
cd /cygdrive/
Error: Current working directory is a virtual Cygwin directory which
does not exist for a native Windows application. Can't start native
Windows application from here.
Seems this /cygdrive is broken, does anyone know how to fix it?
Adding more detail:
$grep cygdrive /etc/fstab
# none /cygdrive cygdrive binary,posix=0,user 0 0
$type -a cd
#cd is a shell builtin
I get that error message if I do a cd /cygdrive and then try to execute a (non-Cygwin) Windows command. I don't get it if I just cd /cygdrive.
The only explanation I can think of is that you've assigned a value to the bash special variable $PROMPT_COMMAND.
Quoting the bash documentation:
'PROMPT_COMMAND'
If set, the value is interpreted as a command to execute before
the printing of each primary prompt ('$PS1').
For example:
$ PROMPT_COMMAND=cmd.exe ; cd /cygdrive
Error: Current working directory is a virtual Cygwin directory which does
not exist for a native Windows application.
Can't start native Windows application from here.
-bash: /cygdrive/c/Windows/system32/cmd.exe: Not a directory
move to the right directory by replacing (if you are in C drive for example)
cd /cygdrive
by
cd c:/cygdrive
also suitable:
cd /c/<rest of your path>

cygpath doesn't convert Windows path correctly

command line shell
echo %PIG_HOME%
C:\cygwin\usr\lib\pig
cygwin
echo $PIG_HOME
C:\cygwin\usr\lib\pig
echo $( cygpath -u "$PIG_HOME" )
/usr/lib/pig
cd $( cygpath -u "$PIG_HOME" )
-bash: cd: /usr/lib/pig: No such file or directory
Question: why is cygpath not converting it to /cygdrive/c/cygwin/usr/lib/pig?
UPDATE:
The path to the pig folder is correct.
command line shell
C:\Users\john.doe> cd %PIG_HOME%
C:\cygwin\usr\lib\pig>
cygwin
john.doe#COMPUTER ~
$ cd /cygdrive/c/cygwin/usr/lib/pig/
john.doe#COMPUTER /cygdrive/c/cygwin/usr/lib/pig
$
With Cygwin,
C:\cygwin\lib\pig = /usr/lib/pig
and
C:\cygwin\usr\lib\pig = /cygdrive/c/cygwin/usr/lib/pig
This setup is by design.
The C:\cygwin\usr\lib folder is not created by any packages and should not be created by you either.
Type mount in your terminal window.
My c:\cygwin\bin and c:\cygwin\lib\ are mounted at /usr/bin and /usr/lib respectively. I suspect that your c:\cygwin\usr\lib is mounted at /usr/lib.
Therefore, the "unix" path to c:\cygwin\usr\lib\pig would be /usr/lib/pig.
Did you try option "-m, --mixed : like --windows, but with regular slashes (C:/WINNT)"
$ cd /cygdrive/c/cygwin64/home
$ cygpath -m $(pwd)
C:/cygwin64/home

Resources