LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-15-2018, 12:01 PM   #1
gvilkas
LQ Newbie
 
Registered: Feb 2018
Posts: 3

Rep: Reputation: Disabled
Not sure what mkdir did in this case?


I was trying to follow some instructions to set up a lineage OS build package on my latest version of Lubuntu PC. Everything was going ok until I got to a step that says now set up your directories for your build environment. To create them:

mkdir -p ~/bin
mkdir -p ~/android/lineage

so I enter them in the terminal window at the line that says root@PC:/home/user/# and then nothing happens... no confirmation or error and the same root... line reappears. which is normal i believe.

if I put in the command ls in the /home/user i dont see anything there by those names. If i check the higher directories nothing there either until I get to / where I find bin but as it is full of stuff I doubt I created that.

but when I enter the CD command by itself i get ~# then if i enter ls I immediately see android bin home.

But of course I dont understand where that is found? what directory have I ended up in?

Can anyone explain what I misunderstand here please and what I should do? Many thanks

George
 
Old 02-15-2018, 12:17 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
if you want confirmation use the -v switch/option
created parent dir and subdir and tells you want you did
Code:
mkdir -pv ~/partent/subdir/subdir/subdir
if you are in su off of a user then where are you at and as who?
Code:
userx@slackwhere:~
$ su
Password: 
root@slackwhere:/home/userx
# mkdir -pv ~/somesilling/song/oer
mkdir: created directory '/root/somesilling'
mkdir: created directory '/root/somesilling/song'
mkdir: created directory '/root/somesilling/song/oer'

root@slackwhere:/home/userx
# rm -rv ~/somesilling
removed directory '/root/somesilling/song/oer'
removed directory '/root/somesilling/song'
removed directory '/root/somesilling'
I am in my user but look here
Code:
root@slackwhere:/home/userx
# pwd
/home/userx
root@slackwhere:/home/userx
# ls ~/
Desktop    GNUstep        install-nutyx.md5sum  kodi                   test
Downloads  install-nutyx  jdk
when I Print Working Directory (pwd) I get my user logged in as su
but when I List Directory (ls) as su in user I get root home dir because I am root, ( not to mistaken as I am groot), if I su - (hyphen) I go into my root home directory.
Code:
root@slackwhere:/home/userx
# su -

Have a nice day!

root@slackwhere:~# pwd
/root
environment changes ...
so when you where logged in as su under a user then issued you cd to change directory to your home dir who where you when you did that? It determines where you will end up at.
Code:
userx@slackwhere:~
$ su
Password: 
root@slackwhere:/home/userx
# pwd
/home/userx
root@slackwhere:/home/userx
# cd
root@slackwhere:~
# pwd
/root
root@slackwhere:~
#

Mostly you just need to keep in mind what su and su - do when you're in your terminal as far as directory path placement and rights, for more on that look up "environment variables" linux su su - sudo user

Last edited by BW-userx; 02-15-2018 at 12:43 PM.
 
2 members found this post helpful.
Old 02-15-2018, 12:51 PM   #3
gvilkas
LQ Newbie
 
Registered: Feb 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
if you want confirmation use the -v switch/option
created parent dir and subdir and tells you want you did
[code]...
Mostly you just need to keep in mind what su and su - do when you're in your terminal as far as directory path placement and rights, for more on that look up "environment variables" linux su su - sudo user
Thank you I will study your suggestions.
 
Old 02-15-2018, 01:16 PM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

Rep: Reputation: Disabled
Quote:
root@PC:/home/user/#
The directories you just made
Quote:
mkdir -p ~/bin
mkdir -p ~/android/lineage
will be found here, or else in /root.

Last edited by fatmac; 02-15-2018 at 01:17 PM.
 
Old 02-15-2018, 01:42 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
gvilkas, everything you posted in #1 is normal and expected behavior.
'~' is an abbreviation for $HOME, which is the current user's home directory.
since you did these things as root, $HOME would be /root (although for the normal user it's /home/gvilkas or similar).

btw, with 'pwd' you can always find out your present working directory.
 
Old 02-15-2018, 07:25 PM   #6
gvilkas
LQ Newbie
 
Registered: Feb 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
gvilkas, everything you posted in #1 is normal and expected behavior.
'~' is an abbreviation for $HOME, which is the current user's home directory.
since you did these things as root, $HOME would be /root (although for the normal user it's /home/gvilkas or similar).

btw, with 'pwd' you can always find out your present working directory.
I forgot all about that . thanks.
 
  


Reply



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
Help with sed and awk to change L-case letters to U-case for specific lines in a file rootaccess Linux - General 12 05-21-2012 02:50 PM
[SOLVED] mkdir: cannot creat directory. How to enable mkdir for user in usb dir? Foxbat1155 Linux - Newbie 13 02-16-2012 11:20 AM
how to give options like '-v' for mkdir using system call mkdir() ? nehapawar Linux - Newbie 2 02-05-2010 02:13 AM
Copying files from case-sensitive Linux to case-insensitive Windows via CIFS? SlowCoder Linux - General 4 05-07-2008 07:03 PM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 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
Open Source Consulting | Domain Registration