当前位置:网站首页>Introduction to Command Line
Introduction to Command Line
2022-07-20 04:32:00 【梦想家DBA】
What is the command Line?
The command line is a text interface for the computer's operating system.You can use it to traverse and edit your computer's filesystem.Though the command line, you can create new files, edit the contents of those files.delete files.and more.
On Mac and Linux systems, we access the command line through something called bash.
- Navigation
- Manipulation
- Redirection
- Configuration
Introduction
The command line is a text interface for your computer.It's a program that takes in commands and passes them on to the computer's operating system to run.
The advantage of using the command line is its power.You can run programs, write scripts to automate common tasks, and combine simple commands to handle difficult tasks.All of these traits come together to make it an important programming tool.
Filesystem
A filesystem organizes a computer’s files and directories into a tree structure:
- he first directory in the filesystem is the root directory. It is the parent of all other directories and files in the filesystem.
- Each parent directory can contain more child directories and files.
- Each directory can contain more files and child directories. The parent-child relationship continues as long as directories and files are nested.
ls
The first command we’re going to look at is ls
. A command is a directive to the computer to perform a specific task. When you type ls
, the command line looks at the directory you are in, and then “lists” all the files and directories inside of it. Be sure to type the letter l
as in “List” and not the number 1.
In the terminal, the first thing you see is $
. This is called a shell prompt. It appears when the terminal is ready to accept a command.
pwd
The next command we’re going to look at is pwd
, which stands for “print working directory.” It outputs the name of the directory you are currently in, called the working directory.
Together with ls
, the pwd
command is useful to show where you are in the filesystem.
cd I
Our next command is cd
, which stands for “change directory.” Just as you would click on a folder in Windows Explorer or Finder, cd
switches you into the directory you specify. In other words, cd
changes the working directory.
cd II
Instead of using cd
twice in order to move from 2015 to memory, we can use it once and give it a longer argument:
$ cd jan/memory
To navigate directly to a directory, use cd
with the directory’s path as an argument. Here, cd jan/memory
navigates directly to the memory directory.
To move up one directory, we use cd ..
:
$ cd ..
Here, cd ..
navigates up from jan/memory/ to jan/.
mkdir
Now that we can traverse the existing filesystem, let’s try editing it by making directories (folders) through the command line. The command for that is mkdir
:
$ mkdir media
The mkdir
command stands for “make directory”. It takes in a directory name as an argument and then creates a new directory in the current working directory.
Here we used mkdir
to create a new directory named media/ inside our working directory.
touch
Now we know how to create directories through the command line, but how do we create new files?
We can do this using the command touch
:
$ touch keyboard.txt
The touch
command creates a new file inside the working directory. It takes in a filename as an argument and then creates an empty file with that name in the current working directory.
Here we used touch
to create a new file named keyboard.txt.
Helper Commands
Now that we’ve covered the basics of navigating your filesystem from the command line, let’s look at some helpful commands that will make using it easier!
clear
is used to clear your terminal, which is useful when it’s full of previous commands and outputs. It doesn’t change or undo your previous commands, it just clears them from the view. You can scroll upwards to see them at any time.
tab can be used to autocomplete your command. When you are typing the name of an existing file or directory, you can use tab to finish the rest of the name.
The up and down arrows (↑ and ↓) can be used to cycle through your previous commands. ↑ will take you up through your most recent commands, and ↓ will take you back through to the most recent one.
边栏推荐
- NFT fashion shoes ar interactive zero foundation tutorial is coming!
- [advanced C language] - detailed explanation of user-defined types
- 追根问底:Objective-C关联属性原理分析
- [Muduo socket] InetAddress encapsulates the socket address type
- HMS Core音频编辑服务支持7种音频特效,助力一站式音频处理
- How to delete headers, footers and horizontal lines in word documents
- 有奖调研 | 让虚拟照入现实的完美AR开发平台长什么样?
- How to protect user privacy without password authentication?
- Excel printing skills summary of twelve excel printing skills
- Relationship between accuracy, recall and confidence
猜你喜欢
Introduction, installation and basic use of mongodb database
Office软件无法正常启动0xc0000142怎么解决?
[disadvantages of select and poll, and advantages of epoll]
This beta version of Typora is expired,please download and install a newer version.
Apache Flink's yarn session submission process
Excel printing skills summary of twelve excel printing skills
EF core learning notes: additional foreign key attributes / single navigation attributes
Virtual reality coexists, building a digital intelligence life | HMS core Sparkle application innovation sub forum registration launch
vivo官网APP全机型UI适配方案
[advanced C language] - detailed explanation of user-defined types
随机推荐
cnvd_ 2019_ twenty-two thousand two hundred and thirty-eight
This beta version of Typora is expired,please download and install a newer version.
jdbc error code
Distributed notes (05) - etcd of distributed lock (distributed lock principle, etcd characteristics, distributed lock implementation scheme)
Real time debugging practice based on attach to process
Get the date of the year (number in the range 1-366) date from the object
Returns the quarter and year of the date provided
China's first white paper on the application of electronic signatures in the construction industry was released
老域名建站有什么优势?
HMS Core音频编辑服务支持7种音频特效,助力一站式音频处理
EF core learning notes: additional foreign key attributes / single navigation attributes
国外域名能注册吗?
Fiddler5+ lightning simulator 4.0 settings for app packet capturing
买量洞察与渠道评估,助力营销决策优化
HMS core audio editing service supports 7 kinds of audio effects to help one-stop audio processing
怎么批量删除Excel电子表格中不同的文字?
CADisplayLink、NSTimer循环引用解决方案
使用 NSProxy 实现消息转发
[advanced C language] - detailed explanation of user-defined types
Check whether the date is valid