Skip to main content
IBM 
ShopSupportDownloads
IBM HomeProductsConsultingIndustriesNewsAbout IBM
IBM : developerWorks : Linux : Education - Tutorials
LPI certification 101 exam prep, Part 1
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
2. Introducing bash
  


cd and the home directory page 12 of 13


If we wanted to change to our home directory, we could type:


$ cd

With no arguments, cd will change to your home directory, which is /root for the superuser and typically /home/username for a regular user. But what if we want to specify a file in our home directory? Maybe we want to pass a file argument to the myprog command. If the file lives in our home directory, we can type:


$ ./myprog /home/drobbins/myfile.txt

However, using an absolute path like that isn't always convenient. Thankfully, we can use the ~ (tilde) character to do the same thing:


$ ./myprog ~/myfile.txt

Main menuSection menuFeedbackPreviousNext
PrivacyLegalContact