Beberapa command yang sering di gunakan untuk mengelola file, system, process dan lain-lain pada LINUX, saya coba rangkumkan di bawah ini:
File Commands
Command | Description |
ls | List the content of the current directory |
ls -R | List the subdirectories recursively |
ls -a | List all the content, including hidden files |
ls -l | ist the content and its information |
pwd | Output the current directory that you are in |
cd folder1 | Change the working directory to folder1 |
cd | Return to the $Home directory |
cd .. | Go up a directory |
cd - | Return to the previous directory |
cp source destination | Copy source to destination |
cp -r source destination | Copy a folder recursively from source to destination |
mv source destination | Move (or rename) a file from source to destination |
rm file1 | Remove file1 |
rm -f file1 | Remove file1 without prompt |
rm -r folder | Remove a folder and its content recursively |
mkdir foldername | Create a new folder foldername |
file file1 | Show the file type of file1 |
rmdir foldername | Remove an empty folder |
cat file1 file2 | Concatenate file1 to file 2 |
cat > file1 | Concatenate standard input to file1 |
less file1 | View and paginate file1 |
head file1 | Show first 10 lines of file1 |
tail file1 | Show last 10 lines of file1 |
chmod 777 file | Change file permission of file to 777 |
chown user:group file | Change ownership of file to user and group group |
ln -s source destination | Create a symbolic link from source to destination |
File Encryption and Compression
Command | Description |
gpg -c file | Encrypt file |
gpg file.gpg | Decrypt file.gpg |
tar -cf archive.tar foo bar | Create archive.tar from files foo and bar |
tar -xf archive.tar | Extract all files from archive.tar. |
tar -czf archive.tar.gz foo bar | Create archive.tar.gz from files foo and bar, with Gzip compression |
tar -xzf archive.tar.gz | Extract a tar using Gzip |
tar -cjf archive.tar.bz2 foo bar | Create archive.tar.bz2 from files foo and bar, using Bzip2 compression. |
tar -xjf archive.tar.bz2 | Extract a tar using Bzip2 |
gzip file1 | Compress file1 and rename it to file1.gz |
gzip -d file1.gz | Decompress file1.gz |
File Searching Commands
Command | Description |
grep pattern files | Search for pattern in files |
grep -r | Recursive Search |
grep -v | Inverted 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 app | Locate 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 |
Read More