osx 10.7.5 terminal operation rmdir - macos

I'm learning command line using osx terminal. I tried to remove an empty directory but it says Directory not empty. here's what I did:
$pwd
/desktop/temp/stuff/things/frank/joe/alex
$ls
$(shows nothing)
$cd ..
$pwd
/desktop/temp/stuff/things/frank/joe
$rmdir alex
rmdir: alex: Directory not empty
Can you help me with this? thank you

Try ls -a instead of ls to show all files in the directory. There may be invisible files (starting with a .) in that directory.

Related

Why ubuntu terminal unable to find file or directory?

I'm using Ubuntu 20.4.05 LTS. It is not locating any directory as you can see in the image. For example, cd ~/Downloads doesn't take me to the directory.No such file or directory image What should I do?
as a first step you must know the position of the directory by writing the command pwd
pwd
then you can write the ls command to see the contents of the list of folders or directories
ls
if the file you need is in that directory, you can enter that file by writing the command cd
cd
access folder

Change directory in bash script in windows

How can I change my working directory in bash script in windows. I have
~dp0 = C:\test\docker\windows and I want to change my directory to C:\test\build
So it means 2 levels up and then int o build folder
Thanks
Since C:\ is mounted by default into /mnt/c this will work.
Create a .bashrc in your home path by following command:
echo "BUILDDIR=/mnt/c/test/build" >> ~/.bashrc;source ~/.bashrc
cd $BUILDDIR
# Do your work below for example ./configure.
./configure
On my system in Git bash the C:\ root is just /c/ and other dirs from there are whatever they are, so it would be cd /c/test/build/.
You could also still say cd ../../build/.
Good luck.
To change the directory using a bash script is just like you would using normal bash.
cd "C:/test/build"
echo "You're now in the folder, do what you will."
Save the file as .sh and it can be used as such.
Note, when navigation your folders using a bash script remember the directory you'll be starting from is always the home directory.

No such file or directory - terminal won't recognize directory

When I simply try to cd into a directory on my desktop (cd command + drag folder to terminal to generate file path) I get an error that says "No such file or directory" however, as you can see in the screenshot the folder is there on my desktop. What could be the problem? Thanks.
Seems you have to put a space after the cd command, otherwise the Desktop is available with ~/Desktop on macos shell

How to access my Documents via Terminal on Mac?

So every time I type cd /Documents it says
Users-MBP-4:~ user$ cd /Documents
-bash: cd: /Documents: No such file or directory
Users-MBP-4:~ user$
For some reason it only works when I type cd /Applications
I'm not too experienced with Using terminal on the Mac, any advice will help!
Your documents are stored within your home directory, not at the root of the volume.
Try this instead:
cd ~/Documents
The path should be:
cd /Users/YourUserName/Documents
Just substitute for YourUserName

How do I reverse the cd command in the Terminal on Mac OS X?

I am beginning to learn ruby and was following the instructions of one video to access the desktop through the -ls command in the terminal. Now, I would like to get out of the desktop in the terminal and don't know how. I know, I know I am a total noob... but can someone please help. Thanks. BTW the command I wrote was:
my-iMac~ me$ cd Desktop/
my-iMac:Desktop samuel$ ls
Where would you like to go?
Go home: cd or cd ~
Go to the previous working directory: cd $OLDPWD
Go to parent of the current directory: cd ..
Go to any directory you want: cd /path/to/directory
cd .. will take you back up 1 level.
for windows, you can open up the file explorer copy path then in your command prompt type "cd" then paste path. Your command prompt should now default to that path. (you can also type the entire path)
cd C:\Users\username\Documents\Folder

Resources