Putty ssh command line1/30/2024 ![]() ![]() If you want a copy in a different directoryĬp /home/username/myfile.txt /home/path_to/directory_of/file_copyīe careful when writing the name of the destination. Let’s say you have myfile.txt in your working directory, and you want to make a copy of it in the same directory SOURCE is the source file or folder you want to copy and DESTINATION is well, kind of self-explanatory. This command is used for coping files or folders.Ĭopy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY Oftentimes, shared servers don’t tell you the directory you are in. Pwd command can come in really handy when you are accessing your shared hosting account through SSH. Once entered, assuming you are currently in a directory (folder) located in the base your $HOME directory, you should see a result like this: Pwd is a simple command that outputs the full path of your working directory. Pwd - print name of current/working directory It also allows you to create a new file by merging multiple files line output.īy executing this line, the content of info.txt and info2.txt will be saved into mergedinfo.txt. ![]() With no FILE, or when FILE is -, read standard input. The cat command is used to display the content of a file. Rm -r home/username/path_to/myfolder Manual pagesĬat - concatenate files and print on the standard output To delete a directory (folder) and all of it’s content and sub-directories, you need to use the command with the -r (recursive) option to remove all the files and subfolders inside it To delete a file in your current working directory, enter:įor instance, if you want to remove myfile.txt, provided the file is in your current working directory, execute: By default, it does not remove directories. ![]() txt file named “myfile” in the current working directory Update the access and modification times of each FILE to the current time.Ī FILE argument that does not exist is created empty, unless -c or -h is supplied.Ī FILE argument string of “ -” is handled specially and causes touch to change the times of the file associated with standard output. Mkdir /home/username/path_to/create_a/new_directory Manual pages Mkdir $HOME/path_to/create_a/new_directory You can also specify a PATH prepending the name of the folder if you wish to create a directory outside the current working directory of the terminal. All you need to do is enter:Īnd it will create the directory, unless it already exists. Let’s assume you want to create a new folder named “myfolder” in the current working directory of the terminal. The command below will create a directory in the current working directory of the terminal session. The mkdir (Make directory) command is used to create a directory, if the do not already exist. What’s cool here, is you can go back further by adding another two-dots and separating them with a forward slash (/), so if you want to return several levels up in the directory. To move back up one directory simply put. ![]() You can see that you’ve moved your working directory of the terminal session to the new directory as it becomes appended to $ in your console, like $ ĭrwxr-x- 14 It’s a pretty simple command - just type cd followed by the name or PATH to the directory:Īs such, if you want to enter the home directory of your server, you can type:Ĭd /home/username/Some_directory/And_another_one html ncp-app ncp-previewgenerator ncp-web $ ls -lĭrwxr-xr-x 2 root root 4096 Oct 8 21:31 htmlĭrwxr-xr-x 8 root root 4096 Oct 28 23:08 ncp-appĭrwxr-xr-x 4 www-data www-data 4096 Oct 28 23:08 ncp-previewgeneratorĭrwxrwx- 8 www-data www-data 4096 Oct 15 13:18 ncp-webĭrwxr-x- 14 www-data www-data 4096 Oct 14 11:05 $ ls -laĭrwxr-xr-x 7 root root 4096 Oct 28 23:08. Html ncp-app ncp-previewgenerator ncp-web $ ls -a After entering ls, you will see an output that looks like this: $ ls List information about the files (the current directory by default). Get file sizes and disk usage ( du = disk usage) The last of the three most popular text editors worldwide ( Also fairly easy for beginners)Ĭreate or Unpack compressed archives ( tar or untar an archive) One of the most popular text editors ( Old-school, generally considered difficult to learn for a beginner)Īlso one of the most popular text editors ( Easy for beginners) Search for a specific phrase in file/lines Print working directory ( Shows the full path to where you are right now in a terminal session) Print contents of a file or concenates two files into one new file Show directory contents ( List information of files)Ĭhange file timestamps or create a file if specified file does not exist ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |