Getting familiar with terminal 1.

Riza mohammad Khan
2 min readOct 21, 2023

--

The most important tool yet not learned properly.

All of us some time in our career find way to the terminal. Then when we want to do a speific task we go online copy some code and run it. All sort of symbols like #! | we probabily don’t understand. Today after learning about all this stuff with the help of the lecture 1 of the missing_semester i thought it would be nice to write it down so here I am.

Some General commands

Echo: used to print

riza@hussain:~$ echo Riza
Riza

# To include space in between you can wrap it "" or ''

riza@hussain:~$ echo "Riza Mohammad"
Riza Mohammad

Pwd: Prints Working directory

riza@hussain:~$ pwd
/home/riza

its worth knowing that how does the terminal know that when echo is written i have to display the argument given or when pwd is written i have to display the working directly ?

Actually every keyword above mentioned is a program itself written somewhere in the directories. To know in which directly they are we can use `which` command.

Which:

riza@hussain:~$ which pwd
/usr/bin/pwd
riza@hussain:~$ which echo
/usr/bin/echo

Managing directories and files.

  • to create a directory (folder) use mkdir (make directory).
mkdir myFolder
# create new directory myFolder
  • to delete a directory use rmdir (remove directory).
rmdir myFolder # directory should be empty
# removes existing myFolder directory
  • to change directory use cd.
riza@hussain:~$ mkdir user
riza@hussain:~$ cd user
riza@hussain:~/user$ # changes directory for ~ (home) to user
  • to create an empty file use touch.
riza@hussain:~/user$ touch hello.txt 
# this creates a file and doesn't output anything
  • to see available files or directories in a directory use ls (list).
riza@hussain:~/user$ ls
hello.txt
# alternatively you can use ls -l to display permission, date modified also
riza@hussain:~/user$ ls -l
total 0
-rw-r--r-- 1 riza riza 0 Oct 21 17:26 hello.txt
#these -rw-r--r-- are file permission which we will discuss in part2.


  • to move a file or rename it we use mv (move) command.
riza@hussain:~/user$ mv hello.txt riza.txt #renames hello.txt to riza.txt
riza@hussain:~/user$ ls
riza.txt

riza@hussain:~/user$ mkdir hello
riza@hussain:~/user$ mv riza.txt hello/riza.txt # moves riza.txt to folder hello
riza@hussain:~/user$ ls hello
riza.txt
  • to copy a file use cp its similar to move.

thats all and you have completed the terminal basics. we have certain topics like root user,paths,file permissions ,some shortcuts left and that will be all you need for bash.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Riza mohammad Khan
Riza mohammad Khan

Written by Riza mohammad Khan

HI my name is Riza mohammad khan.

No responses yet

Write a response