Updated June 1, 2023
Introduction to Cheat sheet for UNIX
UNIX is a multi-user and multi-family operating system initially derived from AT&T UNIX. Its research development started at AT&T Bell Laboratory Research Center in the 1970s. It was developed by Dennis Ritchie, Ken Thompson, Brian Kernighan, Joe Ossanna, and Douglas McIlroy at Bell Labs. It was initially released in the year 1971. Licensed under the free and open-source, and some features were proprietary. The default user interfaces are Graphical User Interface (GUI) and Command Line Interface (CLI). It was entirely written in Assembly Language and C programming language. It was presented with a Turing Award. In this Cheat sheet for UNIX article, we will discuss what UNIX is and the different UNIX commands.
Cheat sheet for UNIX Commands and Content
UNIX commands can often be differentiated or grouped into different categories of powerful commands such as File Commands, Process Management commands, Compression, Network related, File Permissions, Searching, and SSH related. Below is the list of Cheat sheet for UNIX commands which perform different kinds of functionalities and operations in the UNIX operating system are as follows:
UNIX Commands |
Description |
FILE I/O |
|
ls | To list the directory. |
pwd | To show the current directory. |
mkdir folder | To create a new directory with the name folder |
cp f1 f2 | To copy file f1 to file f2 |
mv f1 f2 | To move file f1 to file f2 if there exists a file named f2 |
rm f1 | To delete a file named f1 |
rm –r file | To remove a file forcefully |
rm –r dir | To delete a directory named dir |
rm –rf dir | To forcefully remove a directory named dir |
rm –f f1 | To forcefully remove a file named f1 |
touch file | To create or update a file |
more file | To print the contents of a file as output |
head file | To print the contents of the first 10 lines of the file as output |
tail file | To print the contents of the last 10 lines of the file as output |
PROCESS COMMANDS |
|
ps | To display all the currently active processes in the OS |
kill pid | To kill the process with the mentioned process id as pid |
fg | To bring the recently running job to foreground |
bg | To list all the current background running processes or jobs |
top | To display all the running processes. |
NETWORK |
|
ifconfig | To list down all the network-related details such as all the assigned IP addresses IPv4 and IPv6, network interfaces, etc., |
netstat | To list all the ongoing connections in the local system, the details of ports being listened to, and the services waiting for requests. |
nslookup | To query the DNS lookup and find the related details. |
hostname | To know the details of the hostname and IP address mapped. |
SEARCHING |
|
find | To search the files in the directory specified. |
grep | To search the selected lines in all the files that match the given pattern. |
grep <pattern> <files> | To search for the pattern in given lines. |
grep –rn <pattern> <dir> | To search the pattern recursively for the way in a given directory, including the line number. |
grep –r <pattern> <dir> | To search the pattern recursively for the pattern in a given directory. |
command | grep <pattern> | To search for the pattern in the given output of the command. |
Locate file | To find all the instances of the file using an index-based database system built of updated commands. |
Find file | To find all the occurrences of a file in the actual system file directory. |
Free Tips and Tricks for Using Cheat sheet for Unix Commands
- The UNIX operating system has a kernel, the core part of the system that coordinates the entire functionalities to perform different operations.
- It has a Shell that processes the utility requests by interpreting the UNIX commands provided in the terminal by the user.
- The entire data in the cheat sheet UNIX is organized in a file system.
- The login command will be used to log in to the UNIX system as a valid user before performing any operation, whereas logout is the command to log out from the system as a user.
- Shell Scripting is the programming carried on a cheat sheet UNIX to execute the Kernel’s shell scripts (a series of commands) in the UNIX Operating System.
- The file system security in UNIX is based on the user’s access rights, such as R, W, or X, called R – Read Permission, W – Write Permission, and X – Execute Permission.
- A UNIX system has different commands for a user’s access rights.
The cheat sheet for UNIX commands is as follows:
Cheat sheet for UNIX commands |
Description |
chmod | To modify or change the file mode |
chmod u | To change the file mode to the user |
chmod o | To change the file mode to other |
chmod r | To change the file mode to read |
chmod a | To change the file mode to all |
chmod g | To change the file mode to group |
chmod x | To change the file mode to execute by accessing the directory |
chmod w | To change the file mode to write and delete |
chmod – | To change the file mode to remove the Permission |
chmod + | To change the file mode to add the Permission |
- The compression of different large files can be carried out by using other files such as gzip, zcat, tar, gunzip, etc., to compress and uncompress additional tar files, to create archive files in the zip format, etc.,
Conclusion
UNIX operating systems are primarily used in most server-hosting systems to provide highly scalable and highly available systems. The main features and benefits of the UNIX systems are multitasking and multi-user capabilities to perform multitasking operations to save time and resources for fulfilling long-time taking processing operations. The other main benefit of using cheat sheet UNIX is its security and speed of operations in the given time, producing effective and efficient results.
UNIX has different variants of operating systems, such as Linux, BSD, etc., to provide other customized functionalities. UNIX has more flexibility and can be installed on different machines. Also, it is free to use and open-source, which reduces overhead maintenance costs and is highly beneficial with its operating system design and security and access features.
Recommended Articles
We hope that this EDUCBA information on “cheat sheet for unix” was beneficial to you. You can view EDUCBA’s recommended articles for more information.