7/8/2023 0 Comments Full form of sudo in linuxFor instance, to create a directory with full read, write, and execute permissions for all users, enter mkdir -m777 directory_name. For example, mkdir -p Music/2020/Songs will make the new “2020” directory. -p or –parents create a directory between two existing folders.The mkdir command accepts many options, such as: To make a new directory called Songs inside Music, use this command: The user executing this command must have the privilege to make a new folder in the parent directory, or they may receive a permission denied error.įor example, you want to create a directory called Music: Use the mkdir command to create one or multiple directories at once and set permissions for each of them. You can also use the mv command to rename a file: Mv filename.txt /home/username/Documents. For example, you want to move filename.txt to the /home/username/Documents directory: Simply type mv followed by the filename and the destination directory. Additionally, it doesn’t produce an output upon execution. The primary use of the mv command is to move and rename files and directories. To copy an entire directory, pass the -R flag before typing the source directory, followed by the destination directory:Ĭp -R /home/username/Documents /home/username/Documents_backup 7. To copy the content of a file to a new file in the same directory, enter cp followed by the source file and the destination file: To copy files to a directory, enter the file names followed by the destination directory:Ĭp filename1.txt filename2.txt filename3.txt /home/username/Documents To copy one file from the current directory to another, enter cp followed by the file name and the destination directory. Use the cp command to copy files or directories and their content.
0 Comments
Leave a Reply. |