0% found this document useful (0 votes)
6 views

Basic Linux Commands

The document provides an overview of basic Linux commands including echo, pwd, ls, touch, mkdir, cat, rm, history, cp, and mv. Each command is briefly explained along with examples and usage tips. It serves as a foundational guide for navigating and manipulating files and directories in a Linux environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Basic Linux Commands

The document provides an overview of basic Linux commands including echo, pwd, ls, touch, mkdir, cat, rm, history, cp, and mv. Each command is briefly explained along with examples and usage tips. It serves as a foundational guide for navigating and manipulating files and directories in a Linux environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

BASIC

C OMMANDS
OF LINUX
Echo command
• The echo command just prints out the text arguments to the display.

• $ echo Hello World

• Task: Show your name on terminal screen using echo command


pwd
• Folder is ca lled “directory” in Linux.

• The first directory in the filesystem is aptly named the root directory.

• Navigation of the filesystem, much like real life is helpful if you know where you are and
where you are going.
• To see where you are (current location of your terminal), you can use the pwd
command, this command means “print working directory” and it just shows you which
directory you are in, note the path stems from the root directory.

• $ pwd
echo, pwd and cd
Ls command
• The ls command will list directories and files in the current directory by default, however
you can specify which path you want to list the directories of.
• We are adding two options/arguments with ls command. “ls –a” and “ls –l”
Ls command
• Commands have things called flags (or arguments or options, whatever you want to
ca ll it) to add more functionality.
• We are adding two flags/options/arguments with ls command. “ls –a” and “ls –l”
Ls command
• See how we added -a and -l, well you can add them both together with -la. The order
of the flags determines which order it goes in, most of the time this doesn’t really matter
so you can also do ls -al and it would still work.
Touch and mkdir command
• To create an empty file we use touch command
• To create an empty directory we use directory command
• You can even make multiple files and directories at the same time.
Touch and mkdir command
• You can even make multiple files and directories at the same time.
Cat command
• Cat command, short for concatenate, it not only displays file contents but it can
combine multiple files and show you the output of them. After entering some content
use Ctrl+d to save the file.
Rm command

~Debasish Dash
Rm and rmdir command
Rm and rmdir command
History command
• To check the commands that you used till now
• Want to run the same command you did before, just hit the up arrow in keyboard.
• Another history shortcut is ctrl-R, this is the reverse search command, if you hit ctrl-R and
you start typing parts of the command you want it will show you matches and you can
just navigate through them by hitting the ctrl-R key again. Once you found the
command you want to use again, just hit the Enter key.
• Use ! to run the serial number command.
Used when command is very long.

• !2 will rerun ca t readme.txt


cp
cp command • Cp command is used to copy files
mv

~Debasish Dash
mv command

You might also like