Questions tagged [cat]

`cat` is a command-line utility used to concatenate or copy the contents to standard output from a file or standard input (if no file name is passed).

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

Uniq --count doesn't work properly

I'm trying to solve a problem with counting IPs using uniq -c. My file after using file looks like this : 69.246.75.77 7.44.104.171 195.82.180.9 195.82.180.9 61.115.160.23 56.240.142.58 195.82.180.9 ...
0 votes
1 answer
537 views

"cat ls" messes up my terminal's characters [duplicate]

when I go to my /bin directory and do cat ls it messes up my whole terminal's characters, even my input gets messed up and I have no option but to restart the terminal. I was just watching a toturial ...
0 votes
1 answer
59 views

Bash: variable is not full read in `for` because line contains blank spaces

In for command, variable is not fully saved because of blank spaces. Source file in.csv: VPricingCurrency,Currency,Transactions,VPricingCurrency,Deal,VPricingCurrency CustomerPriceGroup,Customer Price ...
  • 810
0 votes
0 answers
36 views

Can see nothing after typying command ls

Hi Ansible is installed at the Ubuntu whick is installed at Windows10. The Ubuntu used to work well, but now nothing can be seen after entering command ls or dir. And then, after a new file is created ...
0 votes
1 answer
777 views

cat command not found even tough package is installed

I've been running Ubuntu 20.04.3 in a VM for a few weeks without any major problems but when i tried to use cat today it only said: Command 'cat' not found, but can be installed with: sudo apt ...
  • 11
0 votes
1 answer
1k views

How can I disable echo in terminal

This might seem simple but sometimes I need terminal to not echo anything , whether for a specific command or all commands. in windows I could simply do echo off I tend to make files with cat command ...
  • 192
0 votes
1 answer
471 views

cat : Do not read stdin if no input file is given on the command line

I have a script that concatenates files with cat. It contains roughly the following line that hangs the script in reading the standard input if the directory contains no files: cat /path/to/dir/* > ...
0 votes
1 answer
178 views

How to merge many files together? [duplicate]

I have around 58,000 txt files that have the prefix ppdb- in a directory. I want to merge all of them into one file. Wgen I try to merge them using cat ppdb-* >> out.txt it gives me an error ...
1 vote
1 answer
2k views

Unable to read from serial port on command line

I tried reading from /dev/ttyS0 on 1 terminal as root with cat: cat < /dev/ttyS0 and sending message to the serial port from another terminal as root with echo: echo -ne "hello" > /...
  • 105
2 votes
3 answers
943 views

How to redirect the output of 'cat' into a different folder?

I have a Python script, EulerianCycle.py, and an input file, euleriancycle.txt. I am able to get the correct results by doing py EulerianCycle euleriancycle.txt > cat euleriancycleout.txt into the ...
  • 23
0 votes
1 answer
284 views

Why use tee with wget? Isn't it superfluous?

So I came across this code for downloading youtube-dl using wget which pipes into tee here: How can I update youtube-dl? The code being: wget -O - https://yt-dl.org/downloads/latest/youtube-dl | sudo ...
0 votes
2 answers
84 views

How to copy files into a new file

How to copy files from one file to another file that has contents I want to keep? In other words, I want the contents of file1 to go in file2 but the info in file1 to be added to the existing stuff in ...
1 vote
1 answer
121 views

Where is the tab completion "compspec" for commands like cat and ls defined?

Some pretext: I'm installing Jenkins locally, and following the installation, I'm asked to produce a password from a text file in this folder: /var/lib/jenkins/secrets/ However, after entering cat /...
0 votes
2 answers
851 views

how to view the content of /dev/sda file?

I formatted a 160GB drive using: dd if=/dev/zeros of=/dev/sda bs=512 I expect the entire drive is filled with zeros, but how do I check it? I thought I could just cat /dev/sda and see all zeros, ...
  • 147
0 votes
1 answer
59 views

How to fix problem with half outputs results

for f in 20*.txt do sed -n '1p' "$f" | cut -d' ' -f3 >> displayStudentInfo.txt head -3 "$f" | tail -2 >> displayStudentInfo.txt done cat ...
2 votes
1 answer
211 views

How to “cat” or “less” a libreoffice impress .odp file?

Is there any way to cat or less a .odp file just like we have for .odt files as mentioned here
1 vote
1 answer
5k views

Merge multiple zip files in to one

I have over a hundred .zip files that I need to be merged into one. I have found that a possibility is to use: cat "filename1.zip" "filename2.zip" "filenamen.zip">&...
0 votes
1 answer
597 views

SETUID not working in my laptop [duplicate]

Suppose i have two files total 8 -r-sr-xr-x 1 root root 34 Oct 8 17:36 openroot.sh -rwx------ 1 root root 38 Oct 8 17:34 root.txt Content in root.txt : Hi I am root file. Content in openroot.sh : #...
  • 415
0 votes
1 answer
258 views

How to cat and print formatted more than one file?

I have a device in /sys/bus/iio/devices/iio:device0/, and device has lots of files such as in_current0_raw, in_current0_mean_raw, in_current0_scale ... I want to print them periodically in terminal. ...
1 vote
2 answers
4k views

How do I search in multiple files with "cat"? [duplicate]

What I want is to find within a directory all the files containing a match and when it finds the match it shows the file where that match was found. example cat * | grep password: Here it will show ...
  • 11
0 votes
2 answers
1k views

Receiving Permission denied when trying to use cat command to create a file [duplicate]

I am working with Ubuntu version 18.04.4 LTS. I tried to create a file using the following command: sudo cat > filename.yaml and received a "Permission denied error" I can create the file using the ...
0 votes
1 answer
1k views

How to copy the content of a file using command line

My question is may be too simple or hard Is there any way I can copy the content of a file using the command line the same as you do with right click + copy? After that I want to paste what I copied ...
  • 111
0 votes
0 answers
44 views

How to save text file after use cat -n command [duplicate]

I am created file use "cat > sample.txt". after i used "cat -b sample.txt". how to save it. ctrl+x or F2 is not working.cat -b command
  • 103
-1 votes
1 answer
297 views

Cat redirection not working

I used a command set -r noclobber Now I'm not able to reset. cat >1.txt shows Restricted: can't redirect output
0 votes
1 answer
217 views

Two different terminal line commands - the same result

What is the difference between less file-name and cat file-name | less For example: less .bashrc and cat .bashrc | less output the same result.
  • 1,895
0 votes
1 answer
130 views

Search number list in multiple files and print

I am trying to find a few numbers listed in a file and their next +16 rows, from a bunch of files in a folder. Print or store output in a file, but the command is not displaying any output for i in ...
0 votes
1 answer
39 views

How to output a file from line x to another

How can I output the projects.txt contents to another file named newProjects.txt starting from line 4 for example.
  • 105
30 votes
5 answers
13k views

What is the difference between "cat < filename" and "cat filename"?

The simplest way to display file contents is using the cat command: cat file.txt I can get the same result using input redirection: cat < file.txt Then, what is the difference between them?
  • 1,895
2 votes
3 answers
2k 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,...
  • 810
2 votes
1 answer
346 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 ...
0 votes
3 answers
6k 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
1 answer
35 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 ...
0 votes
1 answer
391 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&...
4 votes
2 answers
332 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 ...
  • 478
1 vote
1 answer
162 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
1 answer
8k views

Why I can't read file? [duplicate]

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 ...
  • 389
0 votes
0 answers
272 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
1 answer
665 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
1 answer
4k 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
2 answers
120 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
1 answer
34 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
0 answers
27 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 ...
  • 1,134
0 votes
0 answers
198 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
1 answer
992 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 &...
  • 1
0 votes
1 answer
2k 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?
  • 1,526
0 votes
0 answers
626 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
0 answers
186 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::################====================#####################" >> ...
  • 3
0 votes
0 answers
1k 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, ...
  • 569
6 votes
1 answer
8k 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
1 answer
38k 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 ...
  • 286