11:00 - 17:00

Mon - Fri

Unix Commands Documentation

Command Options Remarks Example
ln - Hard Link. Two files can have the same inode number, permissions, and timestamp. Both files should be on the same file system. Changes made to one file are automatically available in the other. The count of hard links is shown in `ls`. ln origfile linkedfile
ln -s Soft Link. It can be across two file systems. It's also used to link directories. It's just a directory entry containing the pathname. It has "l" in the permission field. The inode of both files is different. ln -s orgfile linkedfile
find -name Search based on filename. find searchpath -name "file search criteria"
ls -a List file contents including hidden files. ls -a
ls -F Lists file contents, marks executable as *, directory as /, and soft link as @. ls -F
chmod - To grant rights to a file. Read permission=4, Write permission=2, and Execute permission=1. Even with 777 rights, only the owner can delete the file while others can edit it. chmod 756 gives all permission to the user, read and write access to the group, and read and execute permissions to other users
umask - Default permissions for file are 666 and directories 777. Of this, umask is subtracted to get default permissions. If umask is 022 then default permission for file will be 644 and directory will be 755.
cp -p Copies file and preserves a file's attributes. cp -p sourcefile destinationfile
grep -i Case-insensitive search. grep -i "search_term" filename
grep -r Recursive search through directories. grep -r "search_term" directory
tar -cvf Create a tarball archive. tar -cvf archive.tar directory
tar -xvf Extract a tarball archive. tar -xvf archive.tar
ps -aux Display information about all processes. ps -aux
kill -9 Force kill a process. kill -9 PID
df -h Display disk space usage in human-readable format. df -h
du -sh Display directory size in human-readable format. du -sh directory
echo -e Enable interpretation of backslash escapes. echo -e "Line1\nLine2"
history - Display command history. history
man - Display the manual for a command. man ls
sudo - Execute a command with superuser privileges. sudo command
wget -O Download files from the web. wget -O filename URL
curl -O Transfer data from or to a server. curl -O URL
nano - Text editor for command line. nano filename
vim - Advanced text editor. vim filename
top - Display real-time system processes. top
uptime - Show how long the system has been running. uptime
date - Display or set the system date and time. date