0% found this document useful (0 votes)
49 views4 pages

Linux Command Command Description: Shows The Current Location in The Directory Tree

Linux commands allow users to navigate directories, view and manage files. Some key commands include: pwd displays the current directory, cd changes directories, ls lists files, cp copies files, mv moves or renames files, rm deletes files, and mkdir and rmdir create and remove directories. Special characters like *, ?, [], ~ and | have specific meanings when used with commands.

Uploaded by

daizy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views4 pages

Linux Command Command Description: Shows The Current Location in The Directory Tree

Linux commands allow users to navigate directories, view and manage files. Some key commands include: pwd displays the current directory, cd changes directories, ls lists files, cp copies files, mv moves or renames files, rm deletes files, and mkdir and rmdir create and remove directories. Special characters like *, ?, [], ~ and | have specific meanings when used with commands.

Uploaded by

daizy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DOS

-.
cd..
/home/vic and you type cd .., you will end up in /home.
An easy way to get
back to your previous location!
dir /w List all files in the current directory, in column
format.
ls directory dir directory List the files in the specified directory.
Example: ls /var/log
ls -l dir List files in long format, one file per line. This
also shows you additional info about the file, such
as ownership, permissions, date, and size.
ls -a dir /a List all files, including hidden files. Hidden files
are those files that begin with a ., e.g. The
.bash_history file in your home directory.
ls -ld
directory
A long list of directory, but instead of showing
the directory contents, show the directory's detailed
information. For example, compare the output of
the following two commands:
ls -l /usr/bin
ls -ld /usr/bin
ls /usr/bin/d* dir d*.* List all files whose names begin with the letter d

Linux Command

Command Description

pwd

Shows the current location in the directory tree.

cd

Change Directory. When typed all by itself, it returns you to your


home directory.

cd directory

cd ..

Change into the specified directory name. Example: cd


/usr/src/linux
~ is an alias for your home directory. It can be used as a shortcut
to your home, or other directories relative to your home.
Move up one directory.

cd -

Return to previous directory.

ls

List all files in the current directory, in column format.

ls directory

List the files in the specified directory. Example: ls /var/log

ls -l

mv

List files in long format, one file per line. This also shows you
additional info about the file, such as ownership, permissions, date,
and size.
List all files, including hidden files. Hidden files are those files
that begin with a ., e.g. The .bash_history file in your home
directory.
A long list of directory, but instead of showing the directory
contents, show the directory's detailed information. For example,
compare the output of the following two commands:
ls -l /usr/bin
ls -ld /usr/bin
List all files whose names begin with the letter d
in the /usr/bin directory.
Copies a file from one location to another.
Example: cp mp3files.txt /tmp
Moves a file to a new location, or renames it.

rm

Delete a file. Example: rm /tmp/mp3files.txt

mkdir

Make Directory. Example: mkdir /tmp/myfiles/

rmdir

Remove Directory. Example: rmdir /tmp/myfiles/

Linux Command

Command Description

cd

ls -a

ls -ld
directory

ls /usr/bin/d*
cp

chmod

change file access permissions

qstat

Shows statistics

qreq
grep

search for given pattern/patterns in the provide


list of _les and print any occurances line-by-line to the
screen.

cd
cd ..

~ is an alias for your home directory. It can be used as a shortcut


to your home, or other directories relative to your home.
Move up one directory.

ls

List all files in the current directory, in column format.

pwd

Shows the current location in the directory tree.

Character

Description

Escape character. If you want to reference a special character, you must


escape it with a backslash first.
Example: touch /tmp/filename\*
Directory separator, used to separate a string of directory names.
Example: /usr/src/linux.

/
.
..

Current directory. Can also hide files when it is the first character in a
filename.
Parent directory.

User's home directory.

Represents 0 or more characters in a filename, or by itself, all files in a


directory.
Example: pic*2002 can represent the files pic2002, picJanuary2002,
picFeb292002, etc.
Represents a single character in a filename.
Example: hello?txt can represent hello1.txt, helloz.txt, but not
hello22.txt
Can be used to represent a range of values, e.g. [0-9], [A-Z], etc.
Example: hello[0-2].txt represents the names hello0.txt,
hello1.txt, and hello2.txt
Pipe. Redirect the output of one command into another command.
Example: ls | more
Redirect output of a command into a new file. If the file already exists,
over-write it. Example: ls > myfiles.txt
Redirect the output of a command onto the end of an existing file.
Example: echo .Mary 555-1234. >> phonenumbers.txt
Redirect a file as input to a program.
Example: more < phonenumbers.txt
Command separator. Allows you to execute multiple commands on a
single line. Example: cd /var/log ; less messages
Command separator as above, but only runs the second command if the
first one finished without errors.
Example: cd /var/logs && less messages
Execute a command in the background, and immediately get your shell
back. Example: find / -name core > /tmp/corefiles.txt &

?
[]
|
>
>>
<
;
&&
&

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy