Lecture Note
University
University of California San DiegoCourse
DSC 207R | Python for Data SciencePages
1
Academic year
2023
anon
Views
9
Basic UNIX Commands Live Code Now that we're back in the Unix shell, it's critical to keep in mind these commands: ❖ pwd: to see the current working directory ❖ ls: to list the files and folders in the current directory ❖ cd: to change to another directory We need to have a different directory in order to switch to it. There are now only two text filesin our directory. To check if the commands are directories or not, we can list them in lengthyform. There will be a "D" at the start of the line if there is a directory. As our present directory doesn't contain any directories for Python data science, let's make one. The command "mkdir," which stands for make directory, is used to create directories. "My1stDir" will be the name of our initial directory. The "ls" command can be used to verify that the directory has been created after it has been created. The "D" at the beginning of the line, indicating that it is a directory, may be seen if we use the extended form of the command. We can combine the "-a" option, which we learnt about in the last lesson, and the long option to view hidden files. To view all the hidden files in the directory, type "ls -la" into your terminal. We use the "cd" command and the directory's name to navigate to the new directory. The "ls" command can be used to see the directory's contents. Use the "cp" command, followed by the path to the file you want to copy and the location you want to copy it to, to copy a file to the current directory. The "mv" command is used to relocate a file to the current directory. We use the wildcard option "*" followed by the extension we wish to search for to see all the text files in the directory. For instance, we may use the command "ls *.txt" to list all the text files in the directory.
Mastering Basic UNIX Commands
Please or to post comments