1.alias
As the name suggests Linux lets users to create custom commands or shortcuts to existing commands. Using alias convert long commands into mere characters by creating an alias for that command.
List available aliases
alias
Create a new alias
alias ll=’ls -l’
Remove an alias
unalias ll
to keep the aliases persistent add the alias to ~/.bashrc ~/.zshrc files
2. df and du
df command lets you see the available disk space for the filesystems on which the invoking user the required read permissions.
df -h # ‘h’ here is human readable format of memory like MB/GB
du on the other hand lets user see the space usage for a particular directory or file on the given filesystem.
du -h # ‘h’ here is human readable format of memory like MB/GB
3.find
find command is basically used to find files and directories. find supports searching file by file name, type, creation date, modification date, owner and by permissions.
find <search location> -name <filename>
find <search location> -iname <filename> #ignore case
find <search location> -type d -name <directory name>
find <search location> -type f -perm 0777 -print
Find files by modified date
find <search location> -mtime 30
Find files by size
find <search location> -size 50M
4. grep
grep 'search text' filename
grep 'search text' <location>
Mostly used options i, r, n which basically stands for ignore case, recursive, line no.
grep -irn 'search text' <location>
5. history
history command lists down all the recent commands that have been recently used.
history
6. ps
ps #Lists the processes running in the current shell
ps -A #Lists all the process running on the system
ps -ax #List all the current processes
7. scp
scp filename remote_user@host:/remote/directory
scp remote_user@host:/remote/filename /local/files
B/w two remote systems from your local system
scp user1@host1.com:/files/file1 user1@host2.com:/files
8. tar
tar – tape archive, used to create compressed archive files. Supports different types of archive types such tar, gzip and bzip.
Create a tar file
tar -cvf target-file.tar source-directory.
# c – Create a new file
# v – Verbose
# f – Filename type of archive file
Untar files
tar -xvf filename.tar
# x – Extract
# v – Verbose
# f – Filename type of archive file
9. top
Key terms to note:
us – processes running under userspace
sy – system kernel processes
id – idle time of CPU
wa – wait time for I/O
0 Comments