The Unix command line has survived and thrived for almost 50 years because it lets people do complex things with just a few keystrokes. Sometimes called "the universal glue of programming," it helps users combine existing programs in new ways, automate repetitive tasks, and run programs on clusters and clouds that may be halfway around the world. This course will introduce its key elements and show you how to use them efficiently.
Manipulating files and directoriesFree
This chapter is a brief introduction to the Unix shell. You'll learn why it is still in use after almost 50 years, how it compares to the graphical tools you may be more familiar with, how to move around in the shell, and how to create, modify, and delete files and folders.How does the shell compare to a desktop interface?50 xpWhere am I?50 xpHow can I identify files and directories?50 xpHow else can I identify files and directories?100 xpHow can I move to another directory?100 xpHow can I move up a directory?50 xpHow can I copy files?100 xpHow can I move a file?100 xpHow can I rename files?100 xpHow can I delete files?100 xpHow can I create and delete directories?100 xpWrapping up100 xp
The commands you saw in the previous chapter allowed you to move things around in the filesystem. This chapter will show you how to work with the data in those files. The tools we’ll use are fairly simple, but are solid building blocks.How can I view a file's contents?100 xpHow can I view a file's contents piece by piece?100 xpHow can I look at the start of a file?50 xpHow can I type less?100 xpHow can I control what commands do?100 xpHow can I list everything below a directory?100 xpHow can I get help for a command?100 xpHow can I select columns from a file?50 xpWhat can't cut do?50 xpHow can I repeat commands?100 xpHow can I select lines containing specific values?100 xpWhy isn't it always safe to treat data as text?50 xp
The real power of the Unix shell lies not in the individual commands, but in how easily they can be combined to do new things. This chapter will show you how to use this power to select the data you want, and introduce commands for sorting values and removing duplicates.How can I store a command's output in a file?100 xpHow can I use a command's output as an input?100 xpWhat's a better way to combine commands?100 xpHow can I combine many commands?100 xpHow can I count the records in a file?100 xpHow can I specify many files at once?100 xpWhat other wildcards can I use?50 xpHow can I sort lines of text?100 xpHow can I remove duplicate lines?100 xpHow can I save the output of a pipe?50 xpHow can I stop a running program?100 xpWrapping up100 xp
Most shell commands will process many files at once. This chapter shows you how to make your own pipelines do that. Along the way, you will see how the shell uses variables to store information.How does the shell store information?50 xpHow can I print a variable's value?100 xpHow else does the shell store information?100 xpHow can I repeat a command many times?100 xpHow can I repeat a command once for each file?100 xpHow can I record the names of a set of files?50 xpA variable's name versus its value50 xpHow can I run many commands in a single loop?100 xpWhy shouldn't I use spaces in filenames?50 xpHow can I do many things in a single loop?50 xp
Creating new tools
History lets you repeat things with just a few keystrokes, and pipes let you combine existing commands to create new ones. In this chapter, you will see how to go one step further and create new commands of your own.How can I edit a file?100 xpHow can I record what I just did?100 xpHow can I save commands to re-run later?100 xpHow can I re-use pipes?100 xpHow can I pass filenames to scripts?100 xpHow can I process a single argument?50 xpHow can one shell script do many things?100 xpHow can I write loops in a shell script?100 xpWhat happens when I don't provide filenames?50 xp
DataCamp Content CreatorSee More
DataCamp offers interactive R, Python, Spreadsheets, SQL and shell courses. All on topics in data science, statistics, and machine learning. Learn from a team of expert teachers in the comfort of your browser with video lessons and fun coding challenges and projects.