Learn the command line


#1

$ pwd
/home/ccuser/workspace/blog
$ blog/
bash: blog/: No such file or directory
$
$ pwd
/home/ccuser/workspace/blog

pwd stands for "print working directory". It outputs the name of the directory you are currently in, called the working directory.

Here the working directory is blog/. In Codecademy courses, your working directory is usually inside the home/ccuser/workspace/ directory.

Together with ls, the pwd command is useful to show where you are in the filesystem.
1.

Let's continue with more commands. In the terminal, print the working directory.
2.

List all files and directories in the working directory.
3.

Then type

cd 2015

Again, print the new current working directory.

List all files and directories in the working directory.
Report a Bug
If you see a bug or any other issue with this page, please report it here.
Learn
Instructions

  1. pwd

#2

@matheny.56,
Could you provide the Instruction
and
the pre-presented code


#3

list all files and directories in the working directory. You'll see that there is now a new file named keyboard.txt.from command line.


#4

@datapro86125,

# have a look at the current working directory
pwd
#list All files in Long-format with Size
ls -als

#5

Hello,

ls lists all of the parent directories. Above these directories, there is one root directory.

Question: What is the command line if I'd like to know the parent directory?

Thank you very much.


#6

@arhammeister,

http://stackoverflow.com/questions/8426058/bash-get-the-parent-directory-of-current-directory

========== a bit of info ==============================

https://en.wikipedia.org/wiki/Cd_(command)

cd by itself or cd ~ will always put you in your home directory.

cd . will leave you in the same directory you are currently in (i.e. your current directory won't change)

cd ~username will put you in username's home directory.

cd dir (without a /) will put you in a subdirectory. for example, if you are in /usr, typing cd bin will put you in /usr/bin, while cd /bin puts you in /bin.

cd .. will move you up one directory.
So, if you are /usr/bin/tmp, cd .. moves you to /usr/bin, while cd ../.. moves you to /usr (i.e. up two levels).
You can use this indirection to access subdirectories too. So, from /usr/bin/tmp, you can use cd ../../local to go to /usr/local.

cd - will switch you to the previous directory (UNIX only).
For example, if you are in /usr/bin/tmp, and go to /etc., you can type cd - to go back to /usr/bin/tmp.
You can use this to toggle back and forth between two directories.

cd is frequently included built directly into a command-line interpreter.
This is the case in most of the Unix shells (Bourne shell, tcsh, bash, etc.), cmd.exe and Windows PowerShell on Windows and COMMAND.COM on DOS.


#7

Thank you very much for the reply. Here is a copy of output after typing "pwd":

/home/ccuser/workspace/blog

Questions:

  1. Is "home" the root directory?

  2. What does the "/" on the very left signify?

Thank you very much.


#8

@arhammeister,

https://en.wikipedia.org/wiki/Unix_filesystem#Conventional_directory_layout


#9

I'm stuck on the very first one the learn how to use command centre. it asks me to type 1 in letter\
i type "one" and it gives me that replie