Belajar Linux: Command Line Cheatsheet Part. 1

Beberapa command yang sering di gunakan untuk mengelola file, system, process dan lain-lain pada LINUX, saya coba rangkumkan di bawah ini:

Baca Juga:  Belajar Linux: Menggunakan Terminal/Command Line Part. 5

File Commands

CommandDescription
lsList the content of the current directory
ls -RList the subdirectories recursively
ls -aList all the content, including hidden files
ls -list the content and its information
pwdOutput the current directory that you are in
cd folder1Change the working directory to folder1
cdReturn to the $Home directory
cd ..Go up a directory
cd -Return to the previous directory
cp source destinationCopy source to destination
cp -r source destinationCopy a folder recursively from source to destination
mv source destinationMove (or rename) a file from source to destination
rm file1Remove file1
rm -f file1Remove file1 without prompt
rm -r folderRemove a folder and its content recursively
mkdir foldernameCreate a new folder foldername
file file1Show the file type of file1
rmdir foldernameRemove an empty folder
cat file1 file2Concatenate file1 to file 2
cat > file1Concatenate standard input to file1
less file1View and paginate file1
head file1Show first 10 lines of file1
tail file1Show last 10 lines of file1
chmod 777 fileChange file permission of file to 777
chown user:group fileChange ownership of file to user and group group
ln -s source destinationCreate a symbolic link from source to destination

File Encryption and Compression

CommandDescription
gpg -c fileEncrypt file
gpg file.gpgDecrypt file.gpg
tar -cf archive.tar foo barCreate archive.tar from files foo and bar
tar -xf archive.tarExtract all files from archive.tar.
tar -czf archive.tar.gz foo barCreate archive.tar.gz from files foo and bar, with Gzip compression
tar -xzf archive.tar.gzExtract a tar using Gzip
tar -cjf archive.tar.bz2 foo barCreate archive.tar.bz2 from files foo and bar, using Bzip2 compression.
tar -xjf archive.tar.bz2Extract a tar using Bzip2
gzip file1Compress file1 and rename it to file1.gz
gzip -d file1.gzDecompress file1.gz

File Searching Commands

CommandDescription
grep pattern files Search for pattern in files
grep -r Recursive Search
grep -vInverted search
grep -i Case insensitive Search
grep -o Show matched part of file only
locate file1 Find file1
whereis command Find binary/source /manual for command
which appLocate a command for the app
look string file1 Display any lines in file1 which contain string as a prefix.
find /dir/ -user name Find files owned by name in dir
find /dir/ -mmin num Find files modifed less than num minutes ago in dir
find /dir/ -name name* Find files starting with name in dir

 

About This Author

IT Engineer, Red Hat Certified System Administrator & Technician (RHCT & RHCSA), Certified Data Center Facilities Operation Manager (CDFOM), Certified Ethical Hacking (CEH), expert in Computer Networking in multi operating system and hardware. Specialties: Linux, Free BSD, *Nix, MS Windows, Data Center, Cisco & Computer Networking

Post A Reply