Basic LINUX commands


Basic Navigation File Manipulation More File Manipulation Account Maintenance File Archival

Basic Navigation

ls directory listing
ls
Basic listing
ls -F
Basic listing, with file type notations (-F)
ls -al
Listing, showing all, including hidden, files (-a) in long format (-l), which includes permissions, modify dates, ownership, etc
cd change directory
cd or cd ~
Change to home directory
cd directory
Change to directory, which is a subdirectory of current directory
cd /directory
Change to directory, which exists under the root directory
cd ..
Change to parent of current directory
cd ~user
Change to user‘s directory
pwd print working directory
pwd
Prints the full path of the current directory

.

Basic Navigation File Manipulation More File Manipulation Account Maintenance File Archival

File Manipulation

cp copy
cp sourcefile destfile
Copies contents of sourcefile to destfile
cp file .
Copies source file to current directory
mv move or rename same syntax as cp
rm remove
rm file
Remove file
rm *
Remove all files in current directory
rm -R directory
Remove directory directory, including all its files and subdirectories

 

mkdir make directory
rmdir remove directory
Basic Navigation File Manipulation More File Manipulation Account Maintenance File Archival

More File Manipulation

chmod change permissions (mode)
chmod vector file
Change permissions on file to user, group, and all permissions delineated by vector, where:
7 = rwx
6 = rw-
5 = r-x
4 = r–
3 = -wx
2 = -w-
1 = –x
0 = —
chmod change file
Change a specific permission change on file. Examples include +x, -x, +gw, -ar

 

chown change ownership
chown user file
Change ownership of file to user
chown user:group file
Change ownership of file to user user and group group
ln link
ln -s file link
Creates a symbolic link called link to file
Basic Navigation File Manipulation More File Manipulation Account Maintenance File Archival

Account Maintenance

passwd change password
chsh change shell type

File Archival

tar archive or unarchive a file
tar -xvf tarfile
Expands the tarfile, including directory structure, starting from the current working directory
tar -cf tarfile sourcefile
Creates a tar archive named tarfile using the file or directory specified by sourcefile
gzip compress or uncompress a file
gzip file
Compress file file
gunzip file
Decompress file file

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s