|
ls
|
- list files in the directory
|
|
ls -al
|
- list long formatted files with hidden files
|
|
cd
|
- return to home directory
|
|
pwd
|
- display current working directory
|
|
touch file
|
- create or update file
|
|
mkdir dir
|
- create a new directory dir
|
|
rm file
|
- remove file
|
|
nano file
|
- edit the file using Nano's editor
|
|
mv file1 file2/dir
|
- rename file1 to file2 or move file1 to dir
|
|
rmdir dir
|
- remove empty directory dir
|
|
rm -r dir
|
- remove directory dir
|
|
cp file1 file2
|
- copy file1 to file2
|
|
cp -r dir1 dir2
|
- copy directory dir1 to dir2 and create dir2 if it does not exist
|
|
chmod file
|
- change file permission
|
|
chmod u-w file
|
- remove the writable permission from file to user
|
|
chmod 777 file
|
- give read, write, execute permission to all
|
|
Operator for chmod
|
|
|
+
|
add the specified modes
|
|
-
|
Remove the specified modes from file or dir
|
|
=
|
Set the specified modes
|
|
chown user:group file
|
- change the ownership of file
|
|
groupadd group
|
- add a new group
|
|
useradd -g group nUser
|
- add a new user to group
|
|
usermod -g group eUser
|
- add an existing user to group
|
|
lid -g group
|
- list all the users in the group
|
|
ping host
|
- ping host
|
|
wget file
|
- download file
|
|
whoami
|
- display the login username
|
|
uname -a
|
- display all the system information
|
|
whereis app
|
- show possible locations of app
|
|
which app
|
- shows the full path of the app
|
|
df -h
|
- show file system disk space usage with human-readable storage size
|
|
du -d0 -h dir
|
- display the directory space usage without displaying subdirectories
|
|
ps
|
- display current active processes
|
|
top
|
- display all running processes
|
|
kill pid
|
- kill a process by ID
|
|
killall procname
|
- kill a process by a name
|
|
tar -cvf file.tar files/dir
|
- create a tar file to archive the files/dir and display the progress in the terminal.
|
|
tar -xzvf file.tar.gz -C dir
|
- extract a tar using Gzip to directory dir
|
|
tar -czf file.gz file.tar
|
- compress the file.tar to file.gz using Gzip
|
|
gzip file
|
- compress file and rename it to file.gz
|
|
gzip -d file.gz
|
- decompress file.gz back to file
|
|
grep pattern files
|
- search for pattern in files, * denotes all the files
|
|
grep -r pattern dir
|
- search for the pattern in dir
|
|
grep -i pattern file
|
- ignore the case and search for the pattern
|
|
command | grep pattern
|
- search for the pattern in the output of command
|
|
locate file
|
- find all instances of file by name
|
|
> file
|
- output operator to overwrite the file
|
|
>> file
|
- append operator to append the text at the end of the file
|
|
|
|
- pipe operator to take the output from the preceding command to be the input of the following command
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.