Tutorial Linux: How to Copy, Move, and Remove Files – UNIX/LINUX may seem complicated to those who have just taken the plunge, but not with our Tutorial Linux for beginners. Learn the basic knowledge such as how to copy and move files, remove files from the directory, and display or search contents of a particular file on your screen to discover how incredible Linux is.
How to copy, move, and remove files
To copy a file, take one particular file stored in your open space area, and use the aforementioned command to copy the file to unixsub directory. To do it, cd to unixsub directory by typing in % cd ~/unixsub and then, type in % cp /vol/examples/tutorial/mathematics.txt . (never forget the dot after txt as it signifies current directory in Linux). This command translates to copy the mathematics.txt file to current working directory without renaming the file.
To move (mv command) a file from your unixsub directory, type in % mv mathematics.bak backups/ . and then simply type in either ls and ls backups to check whether or not it’s worked. As to how to remove files (rm command) and directory (rmdir command) from inside the unixsub directory, enter the following:
% cp mathematics.txt tempfile.txt
% rm tempfile.txt
How to search and display contents
Before you start, clear your terminal window by entering % clear and it’ll automatically present you the new % prompt at its window’s top. To display contents (referred to as concatenate or ct command), simply type in % cat mathematics.txt or % less mathematics.txt for a less written content for large or long text files. To see the next page, press space bar and if you wish to quit just type q. To search through a file, type in % less mathematics.txt then type in / followed with a word you wish to search, for example /maths and you’ll presented with results containing the word.