Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [cat]

cat : A Linux Command Line tool , is used to view the contents of a .txt file.

Filter by
Sorted by
Tagged with
13
votes
4answers
2k views

What is the difference between “cat < filename” and “cat filename”?

The simplest way to display file contents is using the cat line-command: cat file.txt The same result I get using input redirection: cat < file.txt Then, what is the difference between them?
0
votes
0answers
27 views

Using a cat * > function for files in a specific category

I'm trying to cat all .json files in the D:\Dumps\Dumps2019-10-17 directory and for the life of me I can't figure it out. Please help. Edit: I'm using the obunto terminal on a windows 10 os.
2
votes
3answers
102 views

Bash, command to variable (cat), output is on 1 line, <pre> is not working

Issue In bash, output is on 1 line from command, so <pre> is not working in html tag. log=`cat ../local/log/$(ls -t ../local/log | head -1 )` echo ' <tr style="background-color: rgb(250,...
2
votes
1answer
63 views

Program for Ubuntu to detect cat-like typing?

A feline hacker has invaded my home. She frequently crawls across and sits on the keyboard, causing all sorts of mayhem. I have gotten into the habit of locking my computer when I step away for a ...
1
vote
3answers
136 views

Cat command with variable in file name not working

I want to cat or read the contents of file giving absolute path that contains a variable but its not working.. None of the below commands are working. ($line here is the name of file) content=`(cat /...
0
votes
1answer
18 views

Average of CPU and memory use of ALL process that appear during some time interval

I know some ways that I can see the average of CPU and memory use for one process, but I never saw a way to see the average of all process that appeared during some time. The goal is, for example, to ...
1
vote
0answers
44 views

How to change the description of a catkin package?

What command should I use to change the description (line 5) cat package.xml<?xml version="1.0"?> <package format="2"> <name>beginner_tutorials</name> <version>0.0.0&...
3
votes
1answer
134 views

cat | dd inconsistent behavior

From a given a file, I have a requirement to create a copy that is padded with zeros to a specific size. If you create a file with the following. echo test >testfile The output of the following ...
1
vote
1answer
63 views

Use syntax highlighting for cat .gitignore [duplicate]

Is it possible to get syntax highlighting for .gitignore files when using cat? Update: Tried sudo apt-get install python-pygments as suggested by @rovo but when using comments in the .gitignore it ...
0
votes
1answer
392 views

Why I can't read file?

Please look at output: deploy@li445-201:~$ sudo ls -al /var/log/nginx/ total 152 drw-rw-r-- 2 root adm 4096 Mar 26 16:08 . drwxrwxr-x 14 root syslog 4096 Mar 26 06:25 .. -rw-r--r-- 1 ...
0
votes
0answers
78 views

Cat and awk Commands

What does these commands mean in linux? GBPUSD30MIN and USDJPY30MIN are text files with data having 4 columns and 1000 rows. cat GBPUSD30MIN | awk '{ print NF }' | uniq -c awk '{ print $4}' ...
1
vote
1answer
132 views

Converting a linux alias to a desktop launcher [duplicate]

I would like to know how to convert the following simple alias to a desktop launcher: cat ~/info1.txt
3
votes
1answer
756 views

How to bulk extract bitrate data from videos and output them in a text file?

I have several videos in a folder; ~/Downloads/movie1.mkv ~/Downloads/movie2.mkv ~/Downloads/movie3.mkv I would like to extract the bitrate for each file, and output the data into a single text file,...
1
vote
2answers
45 views

How to take value as value without considering it as string when we do cat and grep

I have created the utility that need to be run in all the system without any error by creating the required environment. When ever I run the following command it will take the path value from a config ...
0
votes
1answer
18 views

Concatenate Files with a certain word?

I've been using the cat command to concatenate files. To expedite the process is there a way to cat files that have a certain word in middle of the file name. I know how to use the asterisk to capture ...
0
votes
0answers
20 views

using find and cat command for merging text files orderly [duplicate]

I have a main directory and its sub-directories as; main_directory == main_directory 0001 0102 0203 ... == first order sub_directories 001 002 003 ... == second order sub_directories I use below ...
0
votes
0answers
83 views

Data loss over ttyACM* in Ubuntu 14.04 whereas success on Ubuntu 16.04 when “cat” command is used

I have a development board which will have 3 ACM interfaces when connected to Ubuntu host and i want to transfer data from Host to Device over ttyACM3. I have followed the following procedure for ...
0
votes
1answer
511 views

Script with commands split & cat [duplicate]

I want to split an image.jpg into parts and merge it again. I used the following commands: split -b 1440 image.jpg # It divides it into 6 parts. cat xaa.jpg xab.jpg xac.jpg xad.jpg xae.jpg xaf.jpg &...
0
votes
1answer
797 views

Cat VS vim/nano etc

When I open files in nano/vim I see characters which are not-visible using cat command in terminal. I want to proceed only with output of cat command. How to do that?
0
votes
0answers
110 views

Is there any way to get my scrollback history of terminal?

Is there any way to get my scrollback history of the terminal (not only a history of the terminal but also the file's data that I viewed in terminal using CAT command)?? I want to get the file data ...
0
votes
0answers
100 views

Echo and Cat output problem

I'm trying to run this script: #!/bin/bash for file in /home/dima/Downloads/dir/* do if [ -f "$file" ] then echo "SSS::################====================#####################" >> ...
0
votes
0answers
458 views

“cat *” (read all output) Crashes Terminal and Gedit

This command: cat * > cat_all.txt successfully results in the file cat_all.txt, as expected. However, the text file will not open in Gedit. The behavior is mostly freezing, screen-darkening, ...
4
votes
1answer
3k views

How to unzip only the first few lines of a zip archive?

I have a zipped text file a.zip I want to read the first 10 lines of it. Is it possible to do that without unzipping the whole file?
2
votes
1answer
11k views

Can the cat command edit a text file as well as read it? [duplicate]

I am trying to learn all I can about the cat command. I am going to be using it for its light weight performance and its ability to work in nothing but a command line. I know it can create a text ...
-1
votes
2answers
126 views

What is the output of running cat swapfile? [duplicate]

Why when I run sudo cat swapfile I get a bunch of unknown characters. What do these characters mean? Plus my keyboard then types these unknown characters. As a side note this is an active swap file. A ...
11
votes
4answers
17k views

Appending a line to a file in the cat command?

I can do cat file.txt to get the contents of a file but I also want to tack on a final line of my own choosing. I tried piping (cat file.txt ; echo "My final line") | but only the final line is ...
1
vote
3answers
358 views

Parameters of the 'cat' command [closed]

cat -b test1.txt This command is meant to skip blank lines and number the rest. cat -n test1.txt This command numbers lines no matter what. I tried both of them. One on a file with only spaces ...
17
votes
2answers
5k views

How to use `cat` to see the top of a very long file?

I'd like to know how to cat my-verylong-file and show it from the top instead of the end. Like the man command does.
0
votes
3answers
2k views

Giving cat output to rm

I have file names in a file which I need to delete in a different directory. Let's say I have x and y files in dir a. How do I delete it using cat? I tried, rm -f a/{`cat a.txt`} a.txt has ...
3
votes
3answers
4k views

What is the output of `cat image.png`?

What does the output mean when you do cat image.png? Is this what the image actually is made of? Does it matter what file extension the image has?
3
votes
1answer
21k views

How to use the cat command to find a specific word in a textfile [closed]

I did some research but I was unable to find anything to help, I need to find the word "war" in a text file, I know that I can use the cat command, but I need to modify it somehow, can someone help?
0
votes
0answers
76 views

Use pipes in the terminal [duplicate]

I have a user defined latex .sty file called mathpkgs.sty located in ~/texmf/tex/latex/local/. When I am typing up some articles in a diffferent directory, occasionally I need to view the content of ...
0
votes
2answers
1k views

How to pipe a text file containing mongod arguments to mongod command

So usually I start a mongod process with 2 arguments like this ~$ mongod --dbpath /media/nhuyvan1106/0CB6-189A/linux/mongodb/data --logpath /media/nhuyvan1106/0CB6-189A/linux/mongodb. But I don't ...
1
vote
1answer
537 views

DD vs cat for forensic works (carving in USB)

I'm using the foremost,photorec and other tools for recovering data. What is the best way for cloning the USD or HDD for recovery files? Which one should I use dd or cat or ddrescue? If you ...
0
votes
1answer
237 views

how is the concatenate dog utility installed?

Where is the repo to install dog? To get the command on Ubuntu you can just open a terminal and type: sudo apt-get install dog After the installation you can retrieve all the information ...
0
votes
0answers
371 views

Want to save pulseaudio output as wav or mp3

Recently I have discovered cat file.bmp | padsp tee | aplay But I dont know, how to save the output of this command as audio file. If it would help, I have sox and lame software(I dont know how to ...
0
votes
1answer
347 views

Ubuntu 16.04 doesn't recognise Cat B25 phone external drive

Ubuntu 16.04, working on a Acer Aspire V5 laptop, can not recognise a CAT B25 phone plugged in through USB port. I already checked that a computer with Mac OS can absolutely recognise it (both phone ...
0
votes
1answer
129 views

Redirect command and output to a file [duplicate]

Commands executed: cat a1.txt | grep a | wc -l >> a.txt cat b.txt | grep a | wc -l >> a.txt cat c.txt | grep a | wc -l >> a.txt I want count and the command to append ...
1
vote
2answers
3k views

copy text from file to another

I've been trying to copy the entire text of a file to another The command that I've been using is: echo $(cat file1) > file2 file1 text text in other line more text in other line But my result ...
3
votes
1answer
134 views

Bash with cat for automatic merging pair of files

I have a list of files starting with L- and a folder called L with inside files with the same name, for instance L-some and L/L-some. For each file L- I want to merge append its content into L/L-. I ...
10
votes
3answers
2k views

cat command doesn't show the lines of the text [duplicate]

i am trying to read an odt file from terminal. When i type cat myfile.odt it shows me an image like this
5
votes
5answers
5k views

Numbering paragraphs with the 'cat' command

I'm currently trying to find a way to use the cat command to show a text file as automatically numbered paragraphs for a project I'm doing, but I haven't been able to find a single command. Example: ...
-1
votes
2answers
637 views

bash: Is there any way of printing two files with a single command?

I was trying to print two files with a single command. I have two files: file1 and file2. I used cat file1 file2 > together to combine these two and get a new file together. When I cat together, ...
-1
votes
1answer
94 views

Which Command is faster among ls -R and tree? [closed]

I want to list all the files in all the directories and save them to a text file to keep a record for various reasons. WHAT I HAVE The D Drive and E Drive both consist of over 500 GB of data and ...
-1
votes
2answers
141 views

Joining streams

You normally can pipeline the operations a | b | c where b takes input from a and sends it to c. It has only one input, generated by a. But what if I want to replace a header in file b. I therefore ...
2
votes
0answers
508 views

Printing over ssh: “cat file | lpr” or “lpr file”

I am looking at how to print a file over ssh. Two websites (The Linux Documentation Project and Computer Hope) suggest the command "lpr" but both seem to suggest two different methods, with no obvious ...
0
votes
2answers
188 views

Trouble with Shell Script cat | grep

#!/bin/bash mylanip=$(hostname -I | awk '{print $1}') touch /opt/portmapper/0prelims echo `java -jar /opt/portmapper/portmapper.jar -list | grep $mylanip > /opt/portmapper/0prelims` # HTTPS ...
0
votes
1answer
28 views

how would you store a variables [closed]

how would you store a file using a cat command in a file, say $ENTRY "Input Text $ENTRY cat > $ENTRY /home/me/input_text
-4
votes
1answer
179 views

Difference between “cat” command arguments “-b” and “-n”

I am bit confuse about the command cat filename.txt -b and cat filename.txt -n They show the same output to the screen .Then what is the difference between them?
0
votes
1answer
58 views

Lubuntu script to reverse order of a list state-capital capital-state

I am new to Linux and have a project due in an hour and I know I can use tac to reverse a list, but how do you reverse order like: Birmingham-Alabama Atlanta-Georgia Topeka-Kansas To this: Alabama-...