Lecture Note
University
University of California San DiegoCourse
DSC 207R | Python for Data SciencePages
2
Academic year
2023
anon
Views
29
Basic Unix Commands Exploring the Basics of the Shell: Managing File Systems andUtility Commands in UNIX In the field of technology, many people utilize the UNIX operating system, particularly programmers and system administrators. One of UNIX's most potentfeatures is the shell, or command-line interface, which gives users extensive controlover their operating system. The UNIX shell's essential ideas will be examined in this article, along with three utility commands that can be used to manage the file system: ls , mkdir , and cd . Standard in, standard out, and standard error will also be covered because they arecrucial ideas to comprehend when working with the shell. The Basics of the Shell Let's quickly go through the shell's fundamentals before moving on to the utility commands. In essence, the shell is a program that interprets and executesinstructions. Instead of employing a graphical user interface, it o ers users a way tocommunicate with their operating system by typing instructions. The shell is frequently referred to as a command-line interface in UNIX since it enables keyboard command entry. When a command is entered, the shell will carry itout and give the user the results. The shell's ability to control the file system is one of its most potent capabilities. Any developer or system administrator has to be able to create, delete, and alterfiles and directories, and the shell o ers a variety of commands to do this. Managing the File System with ls, mkdir, and cd One of the most fundamental and important commands for handling the file system is ls. The command is used to list a directory's contents, displaying all of itsfiles and folders along with their names.
Simply type "ls" and the name of the directory you wish to list to use the ls command. To list all the files and directories in the Documents directory, use "ls /home/user/Documents" . Another essential command for managing the file system is mkdir . As the name suggests, this command is used to create new directories. To use the mkdir command, simply enter "mkdir" followed by the name of the new directory you want to create. For example, "mkdir my_new_directory" will create a new directory called "my_new_directory" in the current directory. The cd command is used to change the current directory. To use the cd command, simply enter "cd" followed by the name of the directory you want to change to. For example, "cd /home/user/Documents" will change the current directory to the Documents directory. The Star Character as a Wildcard The shell provides a variety of additional features that can be used to modify the file system in addition to the standard utility commands. The star character (*) , which acts as a wildcard to replace any other character inside a specific pattern, isone example of such a feature. For instance, if you type "ls *.txt," the shell will display a list of every file in the current directory that has the.txt extension. This is a strong feature that enablesspeedy file manipulation and discovery based on names or extensions. Standard In, Standard Out, and Standard Error Let's briefly touch on standard in, standard out, and standard error before we wrap up. As they are used to control input and output from programs, these ideas arecrucial to comprehend while dealing with the shell. The user's default source for entering inputs is standard in. It is often the user's keyboard, but a file redirection makes it simple to change it to another file. Thestandard out is where programs print their primary or functional outputs. The user'sterminal or shell is the default, but it is simple to change it to another process oranother file via a file redirection.
Mastering The Basics of UNIX
Please or to post comments