Basic UNIX Commands on Linux/macOS
(much of the info here is also useful in Windows Powershell)


Folders are called directories in UNIX. When you open the Terminal window, the working directory is set to your home directory, abbreviated ~. Bash shows you the current working directory and your username to the left of its prompt. The following table lists common commands.

Basic UNIX Commands
ls Lists the names of the files in the working directory.
cd directoryname Changes the working directory to the one you named.
cd .. Brings you up one directory level.
cd Returns you to your home directory.
pwd Displays the pathname of the current directory.
mkdir newdirectory Makes a new directory.
rm -r directoryname Removes (deletes) an empty directory.
cp file1 file2 Copies a file.
mv file1 file2 Moves a file or changes its name.
rm filename Removes (deletes) a file.
Control+C Terminates most operations.
date Displays the current date and time.
history Displays the last commands you typed.
top Displays a list of running processes. (Quit by q on macOS, Ctrl+C on Linux)
sudo Lets you carry out commands for which the account you are using lacks authority.
press ↑ to scroll through previously entered commands.

More reading about Unix or macOS command:
Tour of the Terminal: Using Unix or Mac OS X Command-Line

The topics included in the Tour of the Terminal are: using an interactive shell; file system structure, pathnames and permissions; pipelines, sequential execution, background execution and i/o redirection; emacs text editor; commands, options and arguments; building shell scipts; regular expressions; and the Unix stream editor (sed).


如有软件安装或 MD 课程中的任何疑问,请联系 cms.sjtu@gmail.com
或扫码加入微信群: