0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【linuxコマンド】lsコマンド/cdコマンド(絶対パス・相対パス)

Posted at

ターミナルからのPC操作には、linuxコマンドと呼ばれる一連の命令群を用いる。

lsコマンド

lsコマンドはlist(リスト)の略で、フォルダやファイルの一覧を表示するコマンド。カレントディレクトリの直下にあるファイルやフォルダの名前が一覧で表示される

cdコマンド

cdコマンドはchange directoryの略で、ディレクトリを変える、つまりディレクトリを移動するときに使う。
使い方はターミナルで「cd (移動したいディレクトリのパス)」と打ち込んでエンターを押す。単に「cd」とするとホームディレクトリに移動する。

ディレクトリのパスを指定する方法

絶対パス

絶対パスはルートディレクトリから指定するパス。絶対パスで指定するときにはパスの一番最初に/を指定する。

$ cd /Users/Desktop
# 絶対パスは/から始める

相対パス

相対パスは現在いるディレクトリ(カレントディレクトリ)から指定するパス。相対パスで指定するときにはパスの一番最初に/を書かない。

$ cd Users/Desktop
# 相対パスは始めに/をつけない
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?