0% found this document useful (0 votes)
498 views

Linux Basic Commands PDF

The document provides descriptions of common Linux commands for directory operations, file operations, and system monitoring. It describes commands for navigating directories (cd, ls, pwd), creating/deleting directories (mkdir, rmdir), copying/moving/deleting files (cp, mv, rm), viewing file contents (cat, more, head, tail), creating file links (ln), changing file permissions (chmod), archiving files (tar), displaying environment variables (echo), viewing running processes (ps), and terminating processes (kill). Examples are given for most commands.

Uploaded by

baladivya15
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
498 views

Linux Basic Commands PDF

The document provides descriptions of common Linux commands for directory operations, file operations, and system monitoring. It describes commands for navigating directories (cd, ls, pwd), creating/deleting directories (mkdir, rmdir), copying/moving/deleting files (cp, mv, rm), viewing file contents (cat, more, head, tail), creating file links (ln), changing file permissions (chmod), archiving files (tar), displaying environment variables (echo), viewing running processes (ps), and terminating processes (kill). Examples are given for most commands.

Uploaded by

baladivya15
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux basic commands

1. Directory operations
Name: cd
Syntax: cd [directory]
Description: The current working directory to the directory specified by "directory".
Example: enter the directory / usr / bin /:
cd / usr / bin
Name: ls
Syntax: ls [options] [pathname-list]
Description: display the file name within the directory and file name specified in the
"pathname-list"
Example: List all names in the current working directory is s at the beginning of the file:
ls s *
Name: pwd
Syntax: pwd
Description: Displays the absolute path of the current directory.
Name: mkdir
Syntax: mkdir [options] dirName
Description: create name is dirName subdirectory.
Example: In the working directory, create a subdirectory named AA:
mkdir AA
Name: rmdir
Syntax: rmdir [-p] dirName
Description: delete empty directories.
Example: to delete the working directory, subdirectory named AA:
rmdir AA
2 file operations
Name: cp
Syntax: cp [options] file1 file2
Description: Copy the file file1 to file2.
Common options:-r copy the entire directory
Example: aaa copy (existing), and named bbb:
cp aaa bbb
Name: mv
Syntax: mv [options] source ... directory
Description: Rename the file, or the number of files to another directory.
Example: aaa renamed as bbb:
mv aaa bbb
Name: rm
Syntax: rm [options] name ...
Description: delete files and directories.
Commonly used options:-f to force delete files
Example: Remove all but the suffix named c file

rm *. c
Name: cat
Syntax: cat [options] [file-list]
Description: standard output connection, display a list of files in the file-list file
Example 1: Displays the contents of file1 and file2
cat file1 file2
Example 2: file1 and file2 merged into file3
cat file1 file2> file3
Name: more
Syntax: more [options] [file-list]
Description: standard output is connected to the paging file in the file list file-list
Example: paging file AAA
more AAA
Name: head
Syntax: head [options] [file-list]
Description: Display the initial part of the file in the list of files in the file-list, the default display
10 lines;
Example: the initial part of the file AAA
head AAA
Name: tail
Syntax: tail [options] [file-list]
Description: Displays the tail of the list of files in the file-list file; default display 10 lines;
Example: tail file AAA
tail AAA
Name: ln
Syntax: ln [options] existing-file new-file
ln [options] existing-file-list directory
Description: create a link named "existing-file" new-file
, Created with the same name for each file contained in the existing-file-list "link in the
directory catalog
Commonly used options:-f, regardless of whether the new-file exists, create links
-S to create a soft link
Example 1: To establish the soft connection temp.soft, point Chapter3
ln-s Chapter3 temp.soft
Example 2: for all the files and subdirectories in the examples directory to create a soft
connection
ln-s ~ / linuxbook / examples / * / home / faculty / linuxbook / examples
Name: chmod
Syntax: chmod [option] mode file-list
Description: read, write, or execute permissions change or set the parameters in the file-list
Example: Add file job executable permissions
chmod + x job
Name: tar
Syntax: chmod [option] [files]

Description: The backup file. Can be used to create a backup file or restore a backup file.
Example 1: a backup test directory the file named test.tar.gz, executable commands:
tar-zcvf test.tar.gz test
Example 2: Unzip the the associated test.tar.gz file, executable commands:
tar-zxvf test.tar.gz
3.
Name: echo
Syntax: echo $ variable
Description: Displays the value of the variable variable.
Example 1: Display the current user's PATH value
echo $ PATH
Name: ps
Syntax: $ ps [options]
Description: The active process is used to view the current system
Example 1: display all current processes
ps-aux
Name: kill
Syntax: $ kill [-signal] pid
Description: terminates the specified process
Example 1: the process of termination of 1511
kill 1511
Name : ssh
Syantax :$ssh username@hostname

You might also like