Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
109 views

Command Line Codecademy

This document provides an overview of key concepts for navigating and manipulating files from the command line, including commands for listing, copying, moving, and removing files. It also covers redirecting standard input/output, using options to modify command behavior, and configuring the environment by editing the .bash_profile file. The key takeaways are the ability to navigate and manage the filesystem structure, use redirection and pipes, and customize environment settings from the terminal.

Uploaded by

Sai Swetha KV
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Command Line Codecademy

This document provides an overview of key concepts for navigating and manipulating files from the command line, including commands for listing, copying, moving, and removing files. It also covers redirecting standard input/output, using options to modify command behavior, and configuring the environment by editing the .bash_profile file. The key takeaways are the ability to navigate and manage the filesystem structure, use redirection and pipes, and customize environment settings from the terminal.

Uploaded by

Sai Swetha KV
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Congratulations!

You'velearnedfivecommandscommonlyusedtonavigatethefilesystem
fromthecommandline.Whatcanwegeneralizesofar?

Thecommandlineisatextinterfaceforthecomputer'soperatingsystem.Toaccessthe
commandline,weusetheterminal.

Afilesystemorganizesacomputer'sfilesanddirectoriesintoatreestructure.Itstartswith
therootdirectory.Eachparentdirectorycancontainmorechilddirectoriesandfiles.
Fromthecommandline,youcannavigatethroughfilesandfoldersonyourcomputer:

pwdoutputsthenameofthecurrentworkingdirectory.
lslistsallfilesanddirectoriesintheworkingdirectory.
cdswitchesyouintothedirectoryyouspecify.
mkdircreatesanewdirectoryintheworkingdirectory.
touchcreatesanewfileinsidetheworkingdirectory
Congratulations!Youlearnedhowtousethecommandlinetoviewandmanipulatethe
filesystem.Whatcanwegeneralizesofar?
Optionsmodifythebehaviorofcommands:

lsalistsallcontentsofadirectory,includinghiddenfilesanddirectories
lsllistsallcontentsinlongformat
lstordersfilesanddirectoriesbythetimetheywerelastmodified
Multipleoptionscanbeusedtogether,likelsalt
Fromthecommandline,youcanalsocopy,move,andremovefilesanddirectories:

cpcopiesfiles
mvmovesandrenamesfiles
rmremovesfiles
rmrremovesdirectories
Wildcardsareusefulforselectinggroupsoffilesanddirectories
Congratulations!Youlearnedhowtousethecommandlinetoredirectstandardinputand
standardoutput.Whatcanwegeneralizesofar?

Redirectionreroutesstandardinput,standardoutput,andstandarderror.
Thecommonredirectioncommandsare:

>redirectsstandardoutputofacommandtoafile,overwritingpreviouscontent.
>>redirectsstandardoutputofacommandtoafile,appendingnewcontenttooldcontent.

<redirectsstandardinputtoacommand.
|redirectsstandardoutputofacommandtoanothercommand.
Anumberofothercommandsarepowerfulwhencombinedwithredirectioncommands:

sort:sortslinesoftextalphabetically.
uniq:filtersduplicate,adjacentlinesoftext.
grep:searchesforatextpatternandoutputsit.
sed:searchesforatextpattern,modifiesit,andoutputsit.
Congratulations!Youlearnedtousethebashprofiletoconfiguretheenvironment.Whatcan
wegeneralizesofar?

Theenvironmentreferstothepreferencesandsettingsofthecurrentuser.
Thenanoeditorisacommandlinetexteditorusedtoconfiguretheenvironment.
~/.bash_profileiswhereenvironmentsettingsarestored.Youcaneditthisfilewithnano.
environmentvariablesarevariablesthatcanbeusedacrosscommandsandprogramsand
holdinformationabouttheenvironment.

exportVARIABLE="Value"setsandexportsanenvironmentvariable.
USERisthenameofthecurrentuser.
PS1isthecommandprompt.
HOMEisthehomedirectory.Itisusuallynotcustomized.
PATHreturnsacolonseparatedlistoffilepaths.Itiscustomizedinadvancedcases.
envreturnsalistofenvironmentvariables

You might also like