Tag: cat

By Rand Whitehall

damn small linuxIf you want to move a file from one place to another, use the mv, or move command. Now, the mv tool can send a file from one directory to another, but it also can rename a file. If you simply want to change the name of a file, say, from joo.txt to joe.txt, you can do that with mv also. Here are a few examples to get you going.

mv joe joe1

The file joe is simply renamed joe1

mv joe /Documents/joe

The file joe is moved to the Documents directory.

Now, what if we wanted to move joe.txt to the Documents directory and at the same time rename it to joe2?

mv joe Documents/joe2

This would move the file joe to the Documents directory and would change the name to joe2. This is similar to cp, but the original file is changed. With cp we get a new file and the original file is unchanged.

If you’d like to see the contents of a file, use the cat command. cat stands for concatenate. cat will display the contents of a file and also join, or concatenate several files.

cat joe

This command will output the contents of joe.

What if you’d like to view the contents of two or more files?

cat joe bob

Will output the contents of joe and then bob.

Ok. Now let’s play around with cat and two new commands: touch and echo.

Do this:

touch jj.txt

Which will create new text file called jj.txt.

echo “Hi there” >> jj.txt

This adds the text “Hi there!” to jj.txt.

You can append some more text to the end of jj.txt with another echo command and two greater than signs “>>” like this:

echo “How are you?” >> jj.txt

Now take a look at the contents of jj.txt via:

cat jj.txt

One thing to know when using cat, if you use only one greater than sign “>”, it will overwrite the contents of the file. Be careful!

Let’s overwrite jj.txt on purpose.

echo “See you later.” > jj.txt

Now view the contents via cat:

cat jj.txt

… and you should see only the “See you later.” line.

I hope this helped you become a little more familiar with the Linux command line. Have fun and experiment. Remember, while playing around, it’s best to create a new directory and make new files specifically to experiment with so you don’t lose any important data. Soon you’ll be using the command line like a pro!

Rand writes about web design, men’s health and latex free nitrile gloves. Please check out his new website all about Blue Nitrile Exam Gloves for info and nitrile glove knowhow! Rand’s other writings can be found here: Rand Whitehall.

Tags: , , , , ,

Important Unix Commands That You Should Know

By Bernard Peh

Unix is one of the most important operating system today. Its powerful features, scalability, strong security, and support for multiple users have made it the top choice operating systems for server, workstations and mainframes.

It is good to have some knowledge of Unix commands especially if your web host is Unix/Linux based. You could do alot of things by yourself by logging into the server via Secure Shell(SSH). This article will describe some of the important “need to know” Unix commands.

1. ls

This command will show you what files are in your current directory. If you add in a -F option, ie “ls -F xxx”, there will be a “/” appended to the end of directory names, * to executables and @ to links. “ls -a xxx” will display all hidden files as well. This is also the most used command.

2. cd

Change directory. If you type “cd xx”, it means to change to the specified directory “xx”. “cd ~” means to change to your default home directory.

3. cp “a b”

Copy file a to b. If b is a directory, the new file will be named b/a.

4. mv “a b”

Move files from a to b. For example, if I type “mv songs.txt /tmp”, the file songs.txt will be moved to /tmp/songs.txt. Moving a file is the same as renaming a file.

5. echo “text”

Print “text” to the terminal. If “text” is surrounded by double quotes, the text will be printed with any environment variables such as $HOME. If “text” is surrounded by single quotes, the “text” is printed without any special processing.

6. pwd

Print the current working directory. Useful command when you are lost in the directories.

7. cat “file”

Print the contents of the specified file(s) to the terminal.

8. less “file”

Display the specified file one screen at a time. Press the spacebar to go to the next screen. Press Q to quit. You often combine “less” with some other commands such as “cat abc | less”. This command means you print the contents of the file abc and display it one page at a time.

9. ps

Display information about your running programs. This is a good command to use if your server is slow and you suspect that some applications are taking too much memory. The most famous command using ps is “ps aux”. This will display useful information on the running programs.

10. rm

Remove or delete a file. If you type “rm -r directory”, it will remove a directory and all the files underneath it recursively.

11. man

This is the most important command. man means “manual”. If you are stuck with cat command for example, type “man cat” and you can see the help file.

Bernard Peh is a great passioner of web technologies and one of the co-founders of SiteCritic Website Reviews. He works with experienced web designers and developers for more than 5 years, developing and designing commercial and non-commercial websites. During his free time, he does website reviews,freelance SEO and PHP work.

Tags: , , , , , , , , , , ,

Best Beginners Linux Commands

By Dennis Frank Parker

There are many common Linux commands that will be to your benefit, if you ever even use your command line software in Linux. Many average users just use the graphical user interface instead which usually provides many tools and front-ends to Linux common commands. This Linux system tutorial on control commands will help the average user in the event X server accidents, fails, is not properly designed, etc. So stay with me for some of the more prevalent Linux bash instructions.

Some of the more Best free Linux tutorials. A Linux system Unix shell commands tend to be listed below for more information on each command you can always manage man [command] and this will bring up the manage for that command, you can also click on the requires listed for some frequent examples and format.

First before I list them virtually any syntax in [] will be needing some kind of input of your stuff normally, for example:

guy [command] you will want to actually change [command] with the shell order you want to read the guy page for: gentleman ls will give you the man page for the Linux covering command ls.

    • linux ls command – is used to list files on the filesystem.


    • File – command that will check the filetype, this will output to you what the file type is no matter what the extension is.


    • Mkdir command – used to make directories on the filesystem.


    • cd- is used for changing into a different directory in the Linux shell


    • cp – is the Linux copy command, this shell command is used to copy files|directories from one location on the filesystem to another.


    • Mv – the Linux terminal command to move files|directories. Like the cp command, but deletes the original source.


    • rm- shell command in Linux to remove files|directories.


    • Linux cat command- this command is used to print|view the contents of a file to the screen|terminal.


    • Grep – command used to search|find contents of a file and print|view on your terminal|screen.


    • Linux more and less – commands that will allow you to read output of files, unlike cat that will output the entire file at once, even if it is too large for your terminal more and less will output only as many lines as the shell you are in can output, and allow you to scroll through the file contents.


    • Chown – Linux command to change ownership of a file|directory.


    • Linux chmod – command that allows you to change mode of user access|permissions, basically set read, write, and execute permissions.


    • Linux ps – lists the current running processes on your Linux system


  • Linux kill and killall commands – used to kill|terminate running processes

We Provide Best free Linux tutorials and Cbt nuggets training.

Tags: , , , , , , , , , , , , , , ,
Back to top