Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ts_tier_2_012010.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
1.25 Mб
Скачать

C) Linux Shell Commands

Detailed help on any command can be obtained at any time in the Linux shell by typing "man COMMAND_NAME". For example to get help for the cd command, type "man cd". A page will format and display with all the information on that command. To move through the manual, use page up and page down buttons. To exit the manual, type 'q'.

Bash Command

Description

cd

cd Moves you into a different directory.

Usage:

"cd /" will move you to the root directory of the file system, regardless of which directory you are in now. Following the slash with a name, such as "cd /var" will move you to the /var directory off the root.

"cd .." will move you back to the parent directory of your current directory. For example, if you are in the "/home/my_user" directory, "cd .." will move you to the "/home" directory.

"cd MY_DIR" will move you from the current directory into the directory MY_DIR if it exists. If it does not, an error is thrown.

ls

ls Displays a list of items in your current folder.

Usage:

"ls" displays a colour-coded list of files, folders, links, etc. that exist in your current directory. Directories are blue, text files are white, and so on.

"ls -l" shows details about the directory, including the size of files, their permissions, date of creation, and who owns them.

cp

Creates a copy of a file. It can be used to create a copy in a different folder or in the same folder with a different name.

cp old_file new_file will create a copy of old_file named new_file in the same folder.

cp this_folder/oldfile that_folder/newfile will create a copy of oldfile (located in the folder this_folder) named newfile, which will be in the folder that_folder.

mv

Moves a file. Similar to cp, except that mv deletes the original file after creating it. This is mostly used to rename files.

mv old_file new_file will create a copy of old_file which will be named new_file. Then the original file, old_file, will be deleted.

rm

Removes a file. The syntax rm old_file will remove the file named old_file.

Rm –r will remove a directory which still contains files. The –r flag means ‘recursive’.

mkdir

mkdir Makes a new directory.

Usage:

"mkdir DIR_NAME" will create a new directory with the name "DIR_NAME" in the current directory.

rmdir

rmdir Removes a directory.

Usage:

"rmdir DIR_NAME" deletes the directory "DIR_NAME" from the current directory. It will throw an error if the directory does not exist, if you do not have permission to delete it, or if it is not empty. For non-empty directories, see the rm command.

rm Deletes a file, link, or directory.

Usage:

"rm FILE_NAME" deletes the item FILE_NAME from the current directory. Specifying the path removes the item in that path. If the item does not exist, or you don't have permission to remove the file, an error will be thrown.

"rm -rf DIR_NAME" will remove a non-empty directory including all files therein.

nano/pico/emacs/vi are all ways to edit a file. I have listed them in order ease of use. Which will be available to you depends on the specific system.

df

df displays your disk usage.

ping

ping - Test a network connection

traceroute

trace - Find the IP address of a remote host.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]