date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,302,715,144,000
On my Fedora 20 system I use scp a lot, and this is the second time I encounter this. When I run this command: scp -r -P PORT user@host:/home/user/something/{file1,folder1,folder2,folder3,folder4} folder/folder2/ it asks me for the password for each file/directory it transfers. user@host's password: "password here" ...
Your local shell (probably bash) is expanding user@host:/home/user/something/{file1,folder1,folder2,folder3,folder4} into: user@host:/home/user/something/file1 user@host:/home/user/something/folder1 user@host:/home/user/something/folder2 user@host:/home/user/something/folder3 user@host:/home/user/something/folder4 ...
SCP command with selected file and directories for download asks for password for each new file or directory
1,302,715,144,000
So I understand that rsync works by using a checksum algorithm that updates files according to file size and date. But isn't this synchronization dependent on how source and destination are called? Doesn't the order of source to destination change the behavior of what gets synced? Let me get to where I am going.. Obv...
No, rsync only ever syncs files in one direction. Think of it as a smart and more capable version of cp (or mv if you use the --remove-source-files option): smart in the sense that it tries to skip data which already exists at the destination, and capable in the sense that it can do a few things cp doesn't, such as re...
Is rsync really bidirectional or more unidirectional?
1,302,715,144,000
I want to duplicate a directory on an FTP server I'm connected to from my Mac via the command-line Let's say I have file. I want to have files2 with all of file's subdirectories and files, in the same directory as the original. What would be the simplest way to achieve this? EDIT: With mget and mput you could download...
What you have is not a unix command line, what you have is an FTP session. FTP is designed primarily to upload and download files, it's not designed for general file management, and it doesn't let you run arbitrary commands on the server. In particular, as far as I know, there is no way to trigger a file copy on the s...
Easiest way to duplicate directory over FTP
1,302,715,144,000
I have an embedded Linux on a custom board and I would like to send and receive file over its serial port. The only way to communicate with this device is over serial and the device offers a console on this serial port. This board doesn't have kermit neither busybox rx nor lrzsz. - Sending file to remote I was able to...
Finally found out that I was issuing the wrong command on receiver's side. Receive command shall be : cat < /dev/ttyUSB0 > file_b64 Summary To receive from remote : Host side | Remote side | | #Encode to base6...
Retrieve file over serial without kermit and lrzsz
1,302,715,144,000
I have a large file (2-3 GB, binary, undocumented format) that I use on two different computers (normally I use it on a desktop system but when I travel I put it on my laptop). I use rsync to transfer this file back and forth. I make small updates to this file from time to time, changing less than 100 kB. This happens...
Rsync will not use deltas but will transmit the full file in its entirety if it - as a single process - is responsible for the source and destination files. It can transmit deltas when there is a separate client and server process running on the source and destination machines. The reason that rsync will not send delt...
Smarter filetransfers than rsync?
1,302,715,144,000
I need to copy some files from multiple local directories to multiple remote directories. The command: scp -v /file/source1/* username@host_server:/file/destination1 scp -v /file/source2/* username@host_server:/file/destination2 scp -v /file/source3/* username@host_server:/file/destination3 It asks for password again...
You can't have multiple destinations in one scp command. If you want to make a single SSH connection, you'll need to use some other tool. The simplest solution is to mount the remote filesystem over SSHFS and then use the cp command. This requires SFTP access. mkdir host_server sshfs username@host_server:/file host_se...
scp files from multiple directories on local to multiple directories on remote in one command
1,302,715,144,000
My problem is that I need to backup the files on my Linux machine to my Windows laptop. My external hard drive died, and so backing up to an external drive is out of the question for the time being. These are the methods I've tried: Samba Samba with Gadwin GUI Windows Shared Folder, Wirelessly (I can't access it, ev...
NitroShare may be able to do what you're looking for. It is a small app that allows files to quickly be sent between machines on the same network. Once installed on both your Linux and Windows machines, the two machines should automatically discover each other. Use the menu in the system tray to send a file or directo...
Transfer files between Windows and Linux machines?
1,302,715,144,000
Is an implementation of Microsoft's Background Intelligent Transfer Service (BITS) available for Linux systems? I'm looking at my options for transferring large files to a remote Linux server over the internet and I don't want it eat all of my (limited!) upstream bandwidth. I've successfully used BITS on Windows syste...
First, the easy way: rsync has a --bwlimit parameter. That's a constant rate, but you can use that to easily throttle it down. Now, if you want the adaptive rate, there is the linux traffic control framework, which is actually fairly complicated. There are several references I'm aware of: Linux Advanced Routing & Tra...
Transfer large files without hogging the bandwidth (is there a BITS equivalent for Linux?)
1,302,715,144,000
Had a question on NFS mounts and how they interact with transferring files on a low level. I'm trying to understand the latency involved with transferring files from within the same mount. Say you SSH into a VM that has a mount setup. The VM is in USA and the mount is in Europe. Now execute the following command: sudo...
Using mv for a file or folder within an NFS mount will apply the operation remotely. (See this list of API functions or this overview.) This example will execute almost immediately regardless of the size of the file, provided that dir1 and dir2 are part of the same mountpoint: mv /mnt/serverInEurope/dir1/file.txt /mnt...
Unix NFS Mounts and Moving Files
1,302,715,144,000
I have a device running Raspian, that does not have the lrzsz package installed on it. I only have a serial port to the device, and can connect to the device using screen or minicom, but unfortunately I cannot connect find a way to send files over. Also, the device does not have an internet connection. Is there some w...
There might be simpler and more robust ways to transfer files, but this should work: base64 encode your file on the host system base64 file > file.64 Redirect the serial output to a file on the Pi: cat < /dev/ttyAMA0 > file.64 Use minicom's paste feature: Ctrl + A, Y, then select the file to be transferred. Press Ctr...
Serial File Transfer without lrzsz
1,302,715,144,000
I have a ~35 GB file on a remote Linux Ubuntu server. Locally, I am running Windows XP, so I am connecting to the remote Linux server using SSH (specifically, I am using a Windows program called SSH Secure Shell Client version 3.3.2). Although my broadband internet connection is quite good, my download of the large f...
rsync --partial is one simple way to do it if you have rsync, since it runs over ssh just fine. What --partial does is keep a partially downloaded file, so you can just resume from where you got interrupted.
Is it possible to download extremely large files intelligently or in parts via SSH from Linux to Windows?
1,302,715,144,000
I'm doing a file transfer using sftp. Using the get -r folder command, I'm surprised about the order that the program is downloading the content. It looks like it would be selecting the files it needs to download randomly. I can't believe that this is actually the case and I'm asking myself what's going on behind the ...
When you list the directory contents with the ls command, it will sort the listing into alphanumeric order according to current locale's sorting rules by default. It is easy to assume that this is the "natural order" of things within the filesystem - but this isn't true. Most filesystems don't sort their directories i...
In what order does sftp fetch files when using "get -r folder"?
1,302,715,144,000
I can transfer file /tmp/file using rsync to remote server: rsync -R -av /tmp/file root@server:/ but how can I provide the list of files to be transfert from a pipe? I tried using the --files-from= option with /dev/stdin, but that does not work: echo /tmp/file | rsync -R -av --files-from=/dev/stdin root@server:/ (ne...
You still need to specify both source and target arguments to rsync, even when you're reading pathnames from a file: echo /tmp/file | rsync -av --files-from=- / user@server:/ The pathnames read by rsync would be relative to the / source directory. The -R option is implied when using --files-from, and standard input ...
rsync: read list of files from pipe
1,302,715,144,000
I want to let netcat on my server execute a script that works on a file that has just been sent and have the output of this script be sent as the response to the client. My approach is: On the receiving site: nc.traditional -l -p 2030 -e "./execute.sh" > file.iso On the sending site: cat file.iso - | nc.traditional -...
You need some way for the receiving end to recognize the end of the transferred file. With cat file - | nc in the sending side, the data stream through the pipe will make no separation between the contents of the file, and whatever the user types on the terminal (cat - reads the terminal). Also, by default, netcat doe...
How to let Netcat execute command after file transfer is complete?
1,302,715,144,000
Summary: I can't understand a peculiar discrepancy in network transfer. Why is there such a discrepancy in syncing from one machine to the other and vice versa? Also: Given the maximum network transfer speed is about 110 M/sec, and the local disk speed for a similar operation is about 200 M/sec (so, no bottleneck t...
I can only provide a guess, which is that the discrepancy is explained by varying computational, memory, caching or disk characteristics of the two hosts: If we assume that CPU is a bottleneck, then it would make some sense if the slower machine were slower at sending (this assumes that encrypting is more computation...
Understanding why such a discrepancy in network transfer?
1,302,715,144,000
I have around 50 gigabytes that I would like to move. I want to do it over TCP/IP (hence network in the title) optimized for a local area network. My problem is that the connection occasionally gets interrupted and I never seem to get all of the data reliably to its destination. I'd like this thing to not give up so...
Rsync Parameters It would seem that my rsync parameters are fine. I had to add a parameter to deal with files that exist after a connection failure. The choices were --ignore-existing or --update to avoid rewriting things already written. I am still not sure which one is better (perhaps someone knows) but in this ca...
How can I move (rsync) a huge quantity of data reliably the can handle network interruptions?
1,302,715,144,000
I use Fedora 13 and very recently I brought a new Apple iPod shuffle. I would like to know whether I can transfer music into my iPod without using iTunes. I tried using gtkpod and RhythmicBox, but that is of no avail.
I'm not sure about state now but Apple is know for play of cat and mouse. You may find one day that update of software of iPod had broken its compatibly with Linux by completly redesigning its format. Until one day someone reverse engeneer the new format and supplied patches for projects. It lasts as long as Apple wou...
Configuring iPod on Linux
1,302,715,144,000
I tried to copy a large video from my server to my local device with rsync -aP remotefile.mov localfile.mov But the local file does not show up unless I stop the rsync process. I can then watch the partial video with no problem in VLC. How can I watch it while still rsyncing?
You can use the option --inplace This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is complete, rsync instead writes the updated data d...
rsync and watch partially transferred video file
1,302,715,144,000
I was using a script to copy the contents of a folder via SCP, without copying the folder itself. Something like this: scp -i id_rsa -P "$PORT" -r "$HOST:/folder1/folder2/." "backup" (I'm not able to use * because I want to include dot files, too.) This has recently stopped working and I'm getting the following error...
I think your interpretation is correct. It was probably an undocumented feature, removed from the undocumented api (see the web archive of the protocol). One workaround is for you to create a symbolic link in the backup directory before the copy. ln -s . folder2
Copying contents of a folder via SCP results in `scp: error: unexpected filename: .`
1,302,715,144,000
Someone else is giving me a dataset that is too large to send via email, Dropbox, etc., so I'm thinking we can use sftp or scp. But how will she be able to do this without my giving her the password to my machine? This is a one-time transfer of data, so I'd rather not go through a lot of trouble -- if it's too much wo...
Is your machine accessible over the Internet? The first hurdle is that your machine may not be accessible over the Internet at all! Most client machines cannot be accessed directly over the Internet because they don't have a public IP address. It's like having a phone that can call out, but can't be called. This came ...
Transferring files to someone else via sftp
1,302,715,144,000
I have a Canon EOS 350D which has a bent pin in the CF slot. Therefore I do not want to take out the card more often then needed now, retrieving the images via the mini-USB port should be possible, in principle. There are two options I can set the camera to: Print/PTP PC Connection See this screenshot of the camera ...
You could try to use Digikam. With Digikam you can import from a variety of cameras, the 350D should be supported.
Retrieve photos via USB from Canon EOS 350D
1,302,715,144,000
I have the string xyz which is a line in file1.txt, I want to copy all the lines after xyz in file1.txt to a new file file2.txt. How can I achieve this? I know about cat command. But how to specify the starting line?
Using GNU sed To copy all lines after xyz, try: sed '0,/xyz/d' file1.txt >file2.txt 1,/xyz/ specifies a range of lines starting with the first and ending with the first occurrence of a line matching xyz. d tells sed to delete those lines. Note: For BSD/MacOS sed, one can use sed '1,/xyz/d' file1.txt >file2.txt but t...
How to copy the rest of lines of a file to another file [duplicate]
1,302,715,144,000
I’ve made a script that would work on rhel distros and forks. It’s for personal use to automatically download repositories and software that I use. When I make the script executable on the host machine I can right click on the script and choose run as a program. When I copy the script to a flash drive and then copy it...
When I copy the script to a flash drive and then copy it from a flash drive to another computer running the same operating system I have to make it executable again to give back the function to right click and run as a program. Execute permissions are not preserved when you copy files to and from the flash drive bec...
How to make my script stay executable on different devices?
1,302,715,144,000
I would like to request information on using rsync. I tried reading the manuals, but the examples are few and confusing for me. I do not need advanced features or live sync or remote sources or remote destinations. Everything is with ext4. Just using my laptop's HDD and an external HDD over USB. On Ubuntu. My ultimate...
Here is a quick rsync setup and what it does. rsync -avz /home/jonathan /media/jonathan/external-drive/home/jonathan This will recursively copy the files, preserve attributes permissions ownership etc. from /home/jonathan to the external folder. for safe keeping you could also do a tar to get everything together an...
Using rsync to back up /home folder with same permissions, recursive
1,462,812,663,000
I'm trying to write a simple alternative script for uploading files to the transfer.sh service. One of the examples on the website mentions a way of uploading multiple files in a single "session": $ curl -i -F filedata=@/tmp/hello.txt \ -F filedata=@/tmp/hello2.txt https://transfer.sh/ I'm trying to make a function...
One way to avoid having bash word-splitting is to use an array to carry each argument without any need for escaping: push(){ args[${#args[*]}]="$1"; } build() { args=() for file do push "-F" push "filedata=@$file" done } build "$@" curl --progress-bar -i "${args[@]}" https://transfer.sh | grep...
posting data using cURL in a script
1,462,812,663,000
The main reason I want this is my heavy use of dircolors, especially for ls --color=auto. For example, whenever a .mp3 file is copied from NTFS, it will have permissions set by umask 022 which ought to be standard value in most modern distros. However, for audio files this makes no sense: due to the fact that their pe...
I would use the install tool to copy from NTFS. install -m644 file1 ... fileN destination_directory
Setting correct permissions automatically for certain file type when file is copied from non-Linux file system
1,462,812,663,000
I need to find a way to copy files from mymachine to a server priv-server sitting on a private NATted network via a server pub-server with a public IP. The behind-NAT machine priv-server only has certs for user@mymachine, so the certs need to be forwarded from mymachine via pub-server to priv-server So in order to lo...
Instead use a more low level form of copying files by catting them locally, and piping that into a remote cat > filename command on priv-server: $ cat file1.txt | ssh -A user@pub-server 'ssh user@priv-server "cat > file1.txt"' or with compression: $ gzip -c file1.txt | ssh -A user@pub-server 'ssh user@priv-server "gu...
Copying a file using SSH over a tunnel with cert forwarding
1,462,812,663,000
I often transfer large files from a remote server using rsync with the following command : rsync -rvhm \ --progress \ --size-only \ --stats \ --partial-dir=.rsync-partial \ "user@server::module/some_path" "some_path" That way, even if the transfer fails, I can resume it later and I know that I'll ...
It doesn't look like this is possible yet although there is a patch available allowing the use of the --inplace option in conjunction with --partial-dir to avoid this copy. Refer to Bug 13071 for further details but from the description: If --inplace is used with --partial-dir, or with any option implying it (--delay...
rsync keeps previous partial file when resuming
1,462,812,663,000
Using scp command I want to move files from local system to a remote system. I'm doing something like this: $ scp file1 root@abc:root /root/tmp With this command I'm able to upload file1 to abc:/root, but the problem is that it changes the names to tmp like in my case, I want to keep the name the same as the original...
Do this: $ scp file1 root@abc:/root/tmp/ This would also work: $ scp file1 root@abc:~/tmp/ If the directory /root/tmp isn't on the remote system abc, you can do this, and rsync will create the remote directory for you: $ rsync -ave ssh file1 root@abc:/root/tmp Lastly if you have to use ssh you can do this: $ cat fi...
using scp command to transfer files keeping the same names intact?
1,462,812,663,000
I am running a 32-bit Linux virtual machine on KVM. The host machine is a 64-bit Linux machine connected to a LAN. Attempting to transfer files with scp from the KVM machine to a server on the LAN gives abysmal performance, about 500kB/s over gigabit Ethernet. Around 1% of the expected rate. Any suggestions?
Consider using virtio. It allows a direct connection between the VM and the host without the need to emulate (slow) hardware. I measured high network performance improvements with it. For example, you can enable the virtio network device by the kvm command line parameter "-net nic,model=virtio". If you are using the v...
Poor network performance from KVM virtual machine
1,462,812,663,000
I have to transfer a 400Gb database consisting of a single file over the Internet from a server where I have full control to an other computer at the opposite border of the ocean (but which uses a slow connection). The transfer should take a full week and in order to reduce all protocol overhead (even using ftp would ...
If your command, as stated in the comments is: socat -u FILE:somedatabase.raw TCP-LISTEN:4443,keepalive,tos=36 you can, on the sending side, do a seek and start serving from there: socat -u gopen:somedatabase.raw,seek=1024 TCP-LISTEN:4443,keepalive,tos=36 on the receiving side you also need to seek: socat tcp:exampl...
How to resume a file transfer using netcat or socat or curl?
1,462,812,663,000
I have a file on a remote server that I want to transfer to my android device over ssh, only using the android device in the process. Using this setup, I tried an scp from the android device scp remote_user@remote_host:file file After being prompted for the password I got permission denied. I then tried to transfer i...
Physically go to the remote_host and change the file owner to remote_user. sudo chown remote_user /path/to/file Then you should have permissions to copy the file.
Using scp to transfer files to an android device
1,462,812,663,000
When doing ifconfig from hour to hour I notice that the counters for RX/TX bytes transfers resets: RX bytes:921640934 (921.6 MB) TX bytes:4001470884 (4.0 GB) How come? I would like to keep track how much data i transfer from day to day but they keep resetting.
Seems like counters are 32bit integers so they "wrap around" at ~4GB.
Shomehow the rx/tx-counters on the interface resets
1,462,812,663,000
I want to transfer gigabytes of data from server A to B. They are in different networks, but both reachable over SSH. I am in another network (neither A nor B's) so instead of tunneling through my system I'd prefer to do the transfer server to server. How can I best do this over an encrypted channel like SSH? The simp...
If I understand correctly, you want to establish an SSH connection between A and B, let's say from A to B. It is possible to establish a TCP connection from A to B (B isn't behind a firewall that makes this impossible), but you're concerned that allowing a user from A to log in to B might allow a security breach on B ...
How to make a temporary ssh pipe?
1,462,812,663,000
When downloading /var/log/apache2/other_vhosts_access.log (100 MB) from a distant server to my local computer via SFTP, I noticed that the network transfer was not compressed. Indeed similar compressed files are ~ 10 MB and it would have taken 1/10th of the downloading time I observed. Is there an option in SSH/SFTP s...
On WinSCP, transport compression can be enabled in the SSH page on the Advanced Site Settings dialog: For an OpenSSH command line client, the -C option to sftp (passed through as the -C option to ssh) provides transport compression for the session.
Auto-compress SFTP file-transfer to reduce network data usage
1,462,812,663,000
First I will elaborate what is the scenario here. We have 2 servers both are ubuntu 14.04 LTS and we have a drive called /storage/ of 70TB It includes many files of 30GB size each and other ones as well. So as both are the remote servers and I want to move all this data to my other remote server's same drive as /stora...
Is there any way to do it fastly It depends of the network connection speed between source and destination server. 70 TB is a lot of data. It might be worthy physically disconnecting the drive from the server and remounting it on the destination server. and stably so that there will be no data loss in that? If y...
Transferring 70TB data from one remote server to another
1,462,812,663,000
A service on a linux server is only able to do full backups, where each backup is a .tar archive (no compression). Many contents of the archive do not change from day to day. Each .tar file size is about 3GB (slowly increasing from day to day). I want to transfer the backups to another server, which archives them. The...
One thing you might do is to (on the receiving side) copy the last backup file to the new name before starting rsync. Then it will transfer only the diffs between what you have and what you should have. If you do this, be careful if you have rsync -u (update only, based on timestamp) that you ensure that your copy is...
transfer many similar files over ssh
1,462,812,663,000
How can I transfer data by excluding files over 100MB but including files that are over 100MB if they match a pattern of known file extensions? I've read through rsync options and I don't think I can achieve this with rsync, because --max-size= is not flexible like this, even in combination with --include or --exclude...
In two steps (for simplicity, even though these steps can definitely be combined). First transfer "small" files: find /source/path -type f -size -100M -print0 | rsync -av -0 --files-from=- / user@server:/destination/ Then transfer "big" files whose filenames match pattern: find /source/path -type f -size +99M -name '...
How can I transfer data by excluding files over 100MB but including files that are over 100MB if they match a pattern of known file extensions?
1,462,812,663,000
I have two computers connected to the same router (so they are essentially connected in a LAN). Both run some GNU+Linux distribution. I have a bunch of files, in a directory ~/A/ on my first computer that I would like to transfer to my second computer. The names of the files in A are contained in a certain list, say n...
Plenty of remote filesystems exist. There are three that are most likely to be useful to you. SSHFS accesses files via an SSH shell connection (or more precisely, via SFTP). You don't need to set up anything exotic: just install the OpenSSH server on one machine, install the client on the other machine, and set up a ...
Make files available through local address
1,462,812,663,000
A vendor has provided these FTP connection params so I can upload some data for them... Host: host.com Port: 46800 Protocol: FTP – File Transfer Protocol Encryption: Require implicit FTP over TLS Logon Type: Normal User: [ username ] Password: [ password ] It isn't working for me... $ ftp -p host.com 46800 Connected t...
The ftp program is for the insecure ftp protocol. Your vendor has specified that you use Implicit FTP over TLS which is a way to encrypt the connection and keep your credentials and data private over the Internet. Fortunately, there is a program called lftp which understands this protocol. lftp open -u [username] ftp...
How can I connect and upload to this FTP host on the console?
1,462,812,663,000
I've never seen or heard anything like this before, and I can't find anything else online that is at all similar. I've upgraded my network to gigabit and have been transferring large files lately (this one in question is a bunch of DVD images totaling over 200GB). Whenever I try to copy a set of files a few gigs and l...
Marco's comment inspired me to try a few things that I didn't think of, and I discovered the answer. Well, I guess I discovered an alternative. If anyone knows more about this, please add an answer. I ought to have specified beforehand how I was transferring the file. This was done over the network (of course) via a W...
Linux Mint Stops Network File Transfers to Load Data into RAM
1,462,812,663,000
I know how I can send files to a specific directory on a remote server using ssh, but I don't know how to specify it.
There are a few methods. The simplest way if you're just transferring a file once in a while. scp myfile.txt [email protected]:/home/user/ scp stands for secure copy and it transfers over SSH. There is also sftp sftp [email protected] > cd /home/user/ > put myfile.txt I guess the only real advantage to using this is...
How to specify where files are transferred to using ssh
1,462,812,663,000
I have tried to transfer about 50 Gb files from a Redhat Linux variant unsuccessfully to my Debian 8.1. I would like to find other ways than external HDD to move data. There are USB3 connections and HDMI to both machines but nothing else. I am not allowed to install BTsync to transfer the files fast between each othe...
The fact that one machine is running Red Hat and the other Debian won't cause you any problems. For most intents and purposes, the differences between distributions are insignificant. Realistically, you have two options for your data transfer: Using a removable disk, connected using USB or eSATA or similar. Using the...
Mass transfer big files from one Linux box to another Linux box?
1,462,812,663,000
Is there any way to automate the process of copying the files between windows and unix without doing it manually, using tools such as winscp. I need to copy files from unix to windows such by executing some commands in windows. I goolged it and found these tools that can do this. ftp sftp scp pscp winscp console. EDI...
I would use WinSCP script for this Here you have some good piece of documentation on how to do this. Example script : # Automatically abort script on errors option batch abort # Disable overwrite confirmations that conflict with the previous option confirm off # Connect using a password # open sftp://user:[email pro...
copying files from unix to windows?
1,462,812,663,000
Assumed I run a Windows guest in a QEMU virtual machine on a Debian host. Hereby the Debian host is a common desktop computer with internet access. How can I set up a SFTP file exchange between guest and host but prevent the guest (= Windows) from accessing the internet? Set up a Virtual Network Interface (NIC) for t...
Create a new virtual network in virt-manager with its connectivity set to Isolated virtual network. In this configuration, VMs on this network can only access other VMs on the same network and the host (using only the host's IP address for the isolated network).
QEMU: Enable SFTP file exchange (guest ⇆ host) but prohibit guests access to public internet?
1,498,149,937,000
We need to do a once-only archive copying of users' home folders to an archive server (pending final deletion) when they leave, in case they later discover that they may still require some of their files (although we do of course very strongly encourage them to take their own backup of everything they might still need...
If you like tar except for the temp file, this is easy: don't use a temp file. Use a pipe. cd /home ; tar cf - user | gzip | ssh archivehost -l archiveuser 'cat > user.archived.tar.gz' Substitute xz or whatever you prefer for gzip. Or move it over to the other side of the connection, if saving CPU cycles on the main ...
Archiving user home folder to remote server, without following symlinks?
1,498,149,937,000
How can I enable hotspot from my laptop using terminal? I don't need internet connection to do that. I want to set up a server so that I can transfer my files from my laptop to my mobile or another laptops. Is it possible using terminal? I have used python -m SimpleHTTPServer but for that I have to either connect to ...
There is a snap package (it's a new packaging technique created by Ubuntu developers) called wifi-ap. You can use it from terminal to create a wireless network, and even share internet if you want. To install the package : snap install wifi-ap. Then you have to configure the access point with this command wifi-ap.conf...
Wireless Transfer ,How to create hotspot
1,498,149,937,000
I have been trying to get this to work for a few days now, but I can't figure it out. I am trying to scp a folder full of .tar files from my Ubuntu-Server Server to my Windows Desktop. I want to push it from my server to my Desktop, because I'd like to automate the process via a bash script. I am using a command like ...
You have colons in your filenames: backup_minecraft_23_03_2024_22:29:33.tar These are not permitted characters for Windows systems. Remove (or replace) the colons and the files will transfer correctly The following [are] reserved characters: < (less than) > (greater than) : (colon) " (double quote) / (forward slash)...
scp copies folder but not contents of the folder
1,498,149,937,000
I've been using Linux (mostly Ubuntu, but also Manjaro and Fedora) for over 10 years. Lately I've toyed with the idea of moving to Mac OSX. From what I've read, ext4 and HFS+ don't really talk well together. Is there a 'relatively' efficient and painless way of transferring the linux files to OSX?
ftp, sshfs, scp, cifs/samba, rsync, netcat/nc, http (nginx/apache/python3 -m http.server) - just make sure you've checksummed all the files on both ends and hashes do match. All of them are supported under Mac and Linux.
What is a good way to transfer files from linux to OSX?
1,498,149,937,000
The initial problem was that when performing git clone via ssh the transfer rate is very slow, then it pauses and finally fails with connection reset via peer Background ssh server is a Raspberry Pi running Raspbian ssh client I have tried with both an OSX as well as another Raspberry with Raspbian but have the sam...
Setting "IPQoS" to "none" fixed the problem. Thank you so much! I seemed to need to set the option on both the client and server.
scp transfer becomes very slow when the file size is greater than 64KB
1,498,149,937,000
The data transfer to my mp3 player is very slow via USB connection. I have a mp3-player from Samsung (YP-M1JCB/EDC) which I have connected to my Fedora linux (the pc connection in the mp3 player is set to MSC, i.e. mass storage device class). When I connect the mp3 player to my computer with a usb cable, with dmesg I ...
The USB connection resets indicate that there is something physically wrong with your USB device (or maybe the electrical connection). The fact that other drives do not exhibit the problem supports this theory. The logs confirm this. (“end_request: I/O error, dev sdc, …”, etc.) Discard it or do not use it for importa...
where or how to see if data is still being transferred over usb to mass storage
1,498,149,937,000
I have a some internally available servers (all Debian), that share a LetsEncrypt wildcard certificate (*.local.example.com). One server (Server1) keeps the certificate up-to-date and now I'm looking for a process to automatically distribute the .pem-files from Server1 to the other servers (e.g. Server2 and Server3). ...
I've settled on an rsync-only user, that can only rsync data to a predefined directory using ssh-keys (https://gist.github.com/jyap808/8700714). I rsync the files with script that runs after successful letsencrypt deployments. On the receiving servers, I have an inotifywait service running that moves the files to the ...
How to distribute HTTPS certificate/key securely and automatically on internal servers
1,498,149,937,000
Here I have command to transfer inputFile.tar to another bluetooth device (10:68:3F:57:7D:B6). obexftp -b 10:68:3F:57:7D:B6 -p inputFile.tar However, is it possible to use stdout as input for obexftp? For example, I want to do something like this: cat inputFile.tar | obexftp -b 10:68:3F:57:7D:B6 ... gzip -fc inputFil...
I can't find a way with the pipe but you can try this: obexftp -b 10:68:3F:57:7D:B6 - p $(cat inputFile.tar) Return the sdout of the command in the $( )
Pipe stdout to obexftp bluetooth transfer?
1,498,149,937,000
I have a USB drive with Manjaro ARM on it (which is used for Raspberry Pi 4 system) and an empty SD card. Is there a possible way to transfer the OS from USB drive to SD card, while preserving the partitions? If it is possible, can it be done while Manjaro is running? Here is the output of lsblk: $ lsblk # partitions ...
Is there a possible way to transfer the OS from USB drive to SD card, while preserving the partitions? Yes, assuming the sd card it as least as big as the usb drive. You can run blockdev --getsize64 /dev/sda to get the size of your usb drive in bytes, and by changing the device path to the sd card you can ensure i...
Transferring OS from one medium to another
1,498,149,937,000
I'm trying to copy the x86_64 parts of the CentOS 8 repository from http://mirror.centos.org/centos/8/ directly to Artifactory. I've successfully copied some functions (BaseOS, extras, etc) into the local file system, then using jfrog to upload them into Artifactory, but would prefer to copy directly from the CentOS w...
Rclone is a wonderful way of mounting all sorts of things, including http read-only, so the CentOS 8 repo could be mounted on the Artifactory host, and jfrog could upload it from there.
How does one copy parts of a repository to Artifactory?
1,498,149,937,000
Trying to transfer a file from my raspberryPi to my laptop (in the same network) via the terminal, but it takes a while and then says ssh: connect to host 192.168.1.121 port 22: Connection timed out lost connection The command in the terminal reads: $ scp examplefile.txt [email protected]:C:\Users\bruno\Documents W...
I'm guessing your laptop is running Windows 10. For the command you mentioned not working, you need to setup an SSH server on the laptop. Point is, scp relies on remote SSH server to copy files to and from the remote host. As in your case, I'm assuming the Raspberry Pi has an SSH server running on it, so you can alwa...
Network file transfer not going through
1,498,149,937,000
Hi I have two linux machines. Server A (LUbuntu) and Server B (Raspbian). What I want to do is have Server A check in specific a directory(NFS mounted on A) from Server B and IF there are any files transfer them to a location on server A. Ideally after the transfer, any transfered files on B are deleted. Note, that I ...
The basic flaw in this scheme is that there is no way for host B to know when it is safe to copy the files. What if A is writing a file to the NFS-shared dir, and host B picks up on that file before it is completely written? Host B will copy the partial file, and if that (partial) copy is successful, it will delete ...
Automatic file transfer between two linux machines
1,498,149,937,000
I need to transfer 80gb's of unsorted text documents from one computer to another and all I have is a 32gb USB. Is there an option to make rsync automatically pause when the USB is full without losing its place? Manually watching and pausing it is not an option.
I don't think you can do that just like this. You will have to be more creative and e.g. split manually. Fill USB stick with first 32G: tar czf - / | dd if=/dev/stdin of=/usbstick/bla bs=32k count=100k iflag=fullblock Write the first 32G of the resulting tar to the destination dd if=/usbstick/bla of=/tarfile bs=32k c...
Automatically pauseing rsync if target is full
1,498,149,937,000
I've found the following command pretty convenient for transferring files to servers I have ssh access to: cat myfile.txt | ssh my.host.edu "cat > myfile.txt" Is there a similarly convenient command for bringing files to my local computer? If it would make it any easier, I don't mind installing command line utilities...
Try this one : ssh my.host.edu "cat myfile.txt" > myfile.txt But if you want to do file transfert overt ssh, use sftp which is a tool who is dedicated to this.
Transfering files using ssh
1,498,149,937,000
I have a command-line program that continuously generates output on the shell. I would like to be able to transfer the output to another unix host for which I know IP, username and password. Since the program does not terminate, I would also like to continuously update the file, without removing the previous output...
I think an ideal method would involve sending it to the remote server via syslog. This simple ssh command should also work: somecommand | ssh somehost 'cat - >> file.log'
transfer file to remote host and append to file if existing
1,498,149,937,000
I have a Solaris 11 system which has several NFS exports which are accessed my other systems within my LAN. I use a Linux system as a client for testing. I wrote a quick script to test read speed and I average at around 110Mbps (or 13MB/s) on a Gigabit LAN. And I would have think it could get much faster. SSH (scp) on...
NFS can't really maximise the throughput, because the client keeps sending please send me this much data to the server (this much being limited to a few kilobytes) and waits for the full answer before asking for more which means dead times, when all queues are empty. All FS over the network (CIFS, SSHFS) have the same...
targeted network speed over LAN
1,498,149,937,000
I wish to get a file /export/home/remoteuser/stopforce.sh from remotehost7 to localhost /tmp directory. I fire the below command to establish that the file exists on the remote host: [localuser@localhost ~]$ ssh remoteuser@remotehost7 ' ls -ltr /export/home/remoteuser/stopforce.sh' This system is for the use by autho...
You are using the --copy-links option. This is documented with the text When symlinks are encountered, the item that they point to (the referent) is copied, rather than the symlink. [...] If your symbolic link does not point to a file that exists, then the --copy-links option would make rsync complain that it can't...
rsync not working even when the destination file exists
1,498,149,937,000
Suppose, I have some file with path %p which I need to gzip on the fly and send to a remote server and I'm not allowed to use rsync and similar mirroring tools. I do the following: gzip -c -9 %p | ssh user@server "cat > backupPath" In the basic normal case it works good, but I'm wondering what happens when the conne...
It looks like renaming file after download completion is the option since the renaming is an atomic operation. As far as I understand checking the zip integrity doesn't guarantee the file is downloaded completely - there is a very small probability that the part of the file is also correct zip file. But, anyway, I lik...
What happens on ssh file transfer when disconnects?
1,473,877,642,000
i am trying to automate a simple process, but i m new and stuck. I have a number of bash scripts that when ran, zip and move files to specific directories on the linux box. I want to create a bash script that will transfer said files to a specific disk of a windows box on the same network. IE : From Linux Box : [emai...
I guess you need an SSH Server running in your Windows box, in order to do it this way. AFAIK WinSCP is only client, which means that your script should run in your windows box and copy the files from your linux box. I would use something like Bitvise SSH Server, exchange ssh keys between windows and linux boxes and, ...
Copy files from Linux Server to Windows - bash script
1,473,877,642,000
I was in the middle of a file-transfer about an hour ago and, when I came back after a while, the PC had crashed, so I'd like to see if all the files were transferred successfully. I'm using Arch + KDE. EDIT: I just used plain old dolphin with Ctrl+X and Ctrl+V. I have a TrueNAS set up, which runs ZFS RAIDZ2, so I jus...
The only way to see which processes were running at the time of the crash would be if you had kdump or some other crash-dump mechanism set up ahead of time, and the dump was actually performed successfully. Then you could use the ps command of the crash utility to get the list of processes at the time the crash happen...
Is it possible to see which processes were running when the PC crashed last time?
1,473,877,642,000
So I made a simple Bash script that can use your keyboard LEDs (numlock and capslock) to transmit data (inspired by LTT from their "Do NOT Plug This USB In! – Hak5 Rubber Ducky" video). This is the script I have: #!/bin/bash for i in `cat /dev/stdin | perl -lpe '$_=unpack"B*"' | sed 's/./\ &/g'` do export E=`expr $E ...
There are many ways to do this. Since you're already using perl for part of the job, probably the easiest method is to do the entire thing in perl, with the Term::Readkey module. For example: #!/usr/bin/perl -l use Term::ReadKey; # trap INT so we can reset the terminal on ^C $SIG{INT} = sub { exit }; ReadMode 3;...
How to make Bash not wait for EOF?
1,473,877,642,000
I have SUSE Linux Enterprise Server (SP 3), am trying to install the MZ 510 driver by copying the files on my pc to the directory on the server, i get permission denied. Which command should i use to have the read and write permission so i can upload my files.
In comments you say you're trying to put the files in "the root directory". It's unclear if this is / or /root, but in any case, writing to any of these two directories require root permissions, and I'm suspecting that you don't log in as root with winscp (you don't tell). You really only need to offload the files on ...
Copying some files from mypc to a host using winscp
1,473,877,642,000
I am trying to ssh to another machine in my lab using the IP address. The IP address is 137.84.4.211 and let's say the host name is MyName. My IP address is 137.82.81.10. I don't know if this mean two computer share the same local host or not. I tried $ ssh -vv [email protected] debug1: Reading configuration data /etc...
The IP-addresses 137.84.4.211 and 137.82.81.10 are not on the same network. Most likely, it should be either 84 or 82 in both of the addresses.
`ssh` fails to reach destination
1,473,877,642,000
I have a Windows Server 2008 R2 machine and an AIX 6.1 server. Now I would like to map 2 AIX folders to Windows for an application to access - The application on Windows is IBM Connect:Direct and needs to permanently transfer files to and from the Directories on the Unix server. On windows-to-windows this is easy, you...
Install Samba. It provides Windows-compatible SMB/CIFS file and print sharing.
How to map Unix Directories to Windows Server
1,473,877,642,000
I have been messing around bbses lately and want to download some things off them but can't figure out how to on Ubuntu server 18.04. I have tried quite a few things. I know that it is modem downloads so I tried getting Irzsz with the command sudo apt-get install - y Irzsz and it won't work when I go to download thi...
In order to use modem-style protocols, you need a communications program that can run an external rx/rb/sx/sb utility from the lrzsz package and temporarily pass the communication stream to it until the utility exits, or has the equivalent functionality built-in. The ordinary telnet command can't do that, and so it's ...
BBS downloads on Ubuntu Server [closed]
1,473,877,642,000
I have a seriously big problem, when i download any file for example: myfile.zip, or when i load a page for example: myserver.com/welcome.html, the response headers not include content-length and the samething when i download a file, the download show this: I other words, does not show the size of the file and not sh...
The really problem are that you are using a Low quality hosting, that uses Behold Thumper http server, it server mixes the power of apache and nginx, is good for build php websites, but is bad for serve files, i build a solution based on F#, when you call "Header set" you are breaking the directory listing, look below...
How enable content-length header using .htaccess?
1,473,877,642,000
I have a script that exports logs from log management server and send those exports to the archiver server. When I run this script manually, it complete it's task without any problem. It download the exports and send the files to my other server. The thing is, when I write a cronjob to automize this work flow, it jus...
There isn't a need for escape characters or sth else. I forgot to give the full path for the file as in below command. After that, it worked. mv "/opt/access_archive/$exported_file" "/opt/access_archive/${cdate}_$exported_file"
crontab and scp file transfer via script
1,321,145,927,000
I'm looking for the simplest method to print the longest line in a file. I did some googling and surprisingly couldn't seem to find an answer. I frequently print the length of the longest line in a file, but I don't know how to actually print the longest line. Can anyone provide a solution to print the longest line in...
cat ./text | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print y }' UPD: summarizing all the advices in the comments awk 'length > max_length { max_length = length; longest_line = $0 } END { print longest_line }' ./text
How to print the longest line in a file?
1,321,145,927,000
I have a command that produces output in color, and I would like to pipe it into a file with the color codes stripped out. Is there a command that works like cat except that it strips color codes? I plan to do something like this: $ command-that-produces-colored-output | stripcolorcodes > outfile
You'd think there'd be a utility for that, but I couldn't find it. However, this Perl one-liner should do the trick: perl -pe 's/\e\[?.*?[\@-~]//g' Example: $ command-that-produces-colored-output | perl -pe 's/\e\[?.*?[\@-~]//g' > outfile Or, if you want a script you can save as stripcolorcodes: #! /usr/bin/perl u...
Program that passes STDIN to STDOUT with color codes stripped?
1,321,145,927,000
How can I ask ps to display only user processes and not kernel threads? See this question to see what I mean...
This should do (under Linux): ps --ppid 2 -p 2 --deselect kthreadd (PID 2) has PPID 0 (on Linux 2.6+) but ps does not allow to filter for PPID 0; thus this work-around. See also this equivalent answer.
Can ps display only non kernel processes on Linux?
1,321,145,927,000
Let's say we have a text file of forbidden lines forbidden.txt. What is a short way to filter all lines of a command output that exist in the text file? cat input.txt | exclude-forbidden-lines forbidden.txt | sort
Use grep like this: $ grep -v -x -F -f forbidden.txt input.txt That long list of options to grep means -v Invert the sense of the match, i.e. look for lines not matching. -x When matching a pattern, require that the pattern matches the whole line, i.e. not just anywhere on the line. -F When matching a pattern, treat...
How to filter out lines of a command output that occur in a text file?
1,321,145,927,000
I'm using less to view log files quite a lot and every so often I'd like to filter the output by hiding lines which contains some keywords. In less it's possible to filter-out lines with &!<keyword> but that only works for one keyword at a time. I'd like to specify a list of keywords to filter-out. Is this at all poss...
You can use a regular expression: &!cat|dog|fish
Hide lines based on multiple patterns
1,321,145,927,000
I have a directory in which lots of files (around 200) with the name temp_log.$$ are created with several other important files which I need to check. How can I easily list out all the files and exclude the temp_log.$$ files from getting displayed? Expected output $ ls -lrt <exclude-filename-part> -- Lists files not m...
With GNU ls (the version on non-embedded Linux and Cygwin, sometimes also found elsewhere), you can exclude some files when listing a directory. ls -I 'temp_log.*' -lrt (note the long form of -I is --ignore='temp_log.*') With zsh, you can let the shell do the filtering. Pass -d to ls so as to avoid listing the conten...
List files not matching given string in filename
1,321,145,927,000
I have a .CSV file with the below format: "column 1","column 2","column 3","column 4","column 5","column 6","column 7","column 8","column 9","column 10 "12310","42324564756","a simple string with a , comma","string with or, without commas","string 1","USD","12","70%","08/01/2013","" "23455","12312255564","string, with...
awk -F '","' 'BEGIN {OFS=","} { if (toupper($5) == "STRING 1") print }' file1.csv > file2.csv Output "12310","42324564756","a simple string with a , comma","string with or, without commas","string 1","USD","12","70%","08/01/2013","" "23525","74535243123","string , with commas, and - hypens and: semicolans","string...
Filter a .CSV file based on the 5th column values of a file and print those records into a new file
1,321,145,927,000
Given a file L with one non-negative integer per line and text file F, what would be a fast way to keep only those lines in F, whose line number appears in file L? Example: $ cat L.txt 1 3 $ cat F.txt Hello World Hallo Welt Hola mundo $ command-in-question -x L.txt F.txt Hello World Hola mundo I'm looking for a com...
grep -n | sort | sed | cut ( export LC_ALL=C grep -n '' | sort -t: -nmk1,1 ./L - | sed /:/d\;n | cut -sd: -f2- ) <./F That should work pretty quickly (some timed tests are included below) with input of any size. Some notes on how: export LC_ALL=C Because the point of the following operation is to g...
Filter file by line number
1,321,145,927,000
I have some text-files I use to take notes in - just plain text, usually just using cat >> file. Occasionally I use a blank line or two (just return - the new-line character) to specify a new subject/line of thought. At the end of each session, before closing the file with Ctrl+D, I typically add lots (5-10) blank l...
Case 1: awk '!NF {if (++n <= 2) print; next}; {n=0;print}' Case 2: awk '!NF {s = s $0 "\n"; n++; next} {if (n>1) printf "%s", s; n=0; s=""; print} END {if (n>1) printf "%s", s}'
How to remove multiple blank lines from a file?
1,321,145,927,000
I am running a utility that doesn't offer a way to filter its output. Nothing in the text of the output indicates that a particular function failed but it does show in red. The output is so long that at the end when it reports some # of errors I can't always scroll to see the output where the error occurred. How can I...
Switching the color is done through escape sequences embedded in the text. Invariably, programs issue ANSI escape sequences, because that's what virtually all terminals support nowadays. The escape sequence to switch the foreground color to red is \e[31m, where \e designates an escape character (octal 033, hexadecimal...
Filter output of command by color
1,321,145,927,000
I have a huge csv file with 10 fields separated by commas. Unfortunately, some lines are malformed and do not contain exactly 10 commas (what causes some problems when I want to read the file into R). How can I filter out only the lines that contain exactly 10 commas?
Another POSIX one: awk -F , 'NF == 11' <file If the line has 10 commas, then there will be 11 fields in this line. So we simply make awk use , as the field delimiter. If the number of fields is 11, the condition NF == 11 is true, awk then performs the default action print $0.
Keep only the lines containing exact number of delimiters
1,321,145,927,000
If I have a directory full of files and sub directories. What is the best way to list just the regular files which fall alphabetically before a given string? Currently the best I can do using bash is the following: for x in `find . -maxdepth 1 -type f | sort` do if [[ "$x" > './reference' ]] then break ...
if you need all of them find . -maxdepth 1 -type f | sort | awk '$0 > "./reference"' if you need the first find . -maxdepth 1 -type f | sort | awk '$0 > "./reference"{print;exit}'
Find files alphabetically before a given string
1,321,145,927,000
Using jq, how can we select json elements from an array based on inclusion/exclusion of each element's key in some allowlist/blocklist? I want to do a case-insensitive contains (so allowlist/blocklist case would not matter). Here is what I tried (not implemented blocklist): allowlist='["happy", "good"]' blocklist='["s...
Using select, any and all, your filter comes down to jq --argjson allowlist "$allowlist" \ --argjson blocklist "$blocklist" '.[] | select( any ( .my_key ; contains( $allowlist[] ) ) ) | select( all ( .my_key ; contains( $blocklist[] ) | not ) )' Add ascii_downcase to the value of my_key in the ...
How to select based on an allowlist/blocklist using jq
1,321,145,927,000
Should this question be moved to stackoverflow instead? I often need to read log files generated by java applications using log4j. Usually, a logged message (let's call it a log entry) spans over multiple lines. Example: INFO 10:57:01.123 [Thread-1] [Logger1] This is a multi-line text, two lines DEBUG 10:57:01.234 [T...
There is no need to mix many instruments. Task can be done by sed only sed '/^INFO\|^DEBUG\|^TRACE\|^ERROR/{ /Logger2/{ :1 N /\nINFO\|\nDEBUG\|\nTRACE\|\nERROR/!s/\n// $!t1 D } }' log.entry
Filtering multi-lines from a log
1,321,145,927,000
Since a few days, my web/mailserver (centos 6.4) is sending out spammails by the bunch, and only stopping the postfix service is putting an end to it. SMPT is set up to only accept connections over ssl and using username/pwd. And I already changed the password of the (suspected) infected emailaccount. Email was set up...
Pravin offers some good general points, but doesn't really elaborate on any of them and doesn't address your likely actual problems. First, you need to find out how postfix is receiving those messages and why it's choosing to relay them (the two questions are very likely related). The best way to do it is by looking a...
My Postfix installation is sending out spam; how to stop it?
1,321,145,927,000
I am attempting to write a filter using something like sed or awk to do the following: If a given pattern does not exist in the input, copy the entire input to the output If the pattern exists in the input, copy only the lines after the first occurrence to the output This happens to be for a "git clean" filter, but ...
If your files are not too large to fit in memory, you could use perl to slurp the file: perl -0777pe 's/.*?PAT[^\n]*\n?//s' file Just change PAT to whatever pattern you're after. For example, given these two input files and the pattern 5: $ cat file 1 2 3 4 5 11 12 13 14 15 $ cat file1 foo bar $ perl -0777pe 's/.*?5...
Remove lines from file up to a pattern, unless the pattern doesn't exist
1,321,145,927,000
I would like to take the output from a program and interactively filter which lines to pipe to the next command. ls | interactive-filter | xargs rm For example, I have a list of files that a pattern cannot match against to reduce. I would like a command interactive-filter that will page the output of the file list a...
iselect provides an up-down list, (as input from a prior pipe), in which the user can tag multiple entries, (as output to the next pipe): # show some available executables ending in '*sh*' to run through `whatis` find /bin /sbin /usr/bin -maxdepth 1 -type f -executable -name '*sh' | iselect -t "select some executab...
Is there a interactive filter tool when paging output?
1,321,145,927,000
I'm using nfsen and I need to apply a filter to get specific ip range and I can't find the syntax. I searched in the doc of nfdump and tcpdump but nothing. For now the netflows captured provides from multiples address and the ip range I want to get (and only those address) is from 130.190.0.0 to 130.190.127.255 with a...
If you want a filter to capture on packets mathing 130.190.0.0/17: tcpdump net 130.190.0.0/17
tcpdump ip range
1,321,145,927,000
I'd like to extract only a specific value from command output. The string that the command returns is something like this: Result: " 5 Secs (11.2345%) 60 Secs (22.3456%) 300 Secs (33.4567%)" And I want to filter only the "60 Secs" value between () 22.3456% How can I do that?
If that is the exact string that the command returns, then sed will work. command_output | sed 's/.*60 Secs..\(.*\)..300.*/\1/' That prints everything between 60 Secs ( and ) 300. Result: 22.3456%
Extract values from a string that follow a specific word using sed
1,321,145,927,000
I wanted to download all graphic files from our organisation's graphics repository web page. They are Illustrator (.ai) format and Corel Draw (.cdr) format. They are directly hyperlinked (i.e. <a href="http://server/path-to-file.ai">...</a>.
wget includes features to support this directly: wget -r -A "*.ai,*.cdr" 'address-of-page-with-hyperlinks' -r enables recursive mode so it will download more than the given URL, and -A limits the files it will download and keep in the end.
Filter hyperlinks from web page and download all that match a certain pattern
1,321,145,927,000
Reading the manpage of tcpdump I found this example tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet' but I don't understand it, especially the last part. The tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 part filters all the packets having either the SYN or the FIN bit set. What does not src...
You can parse the second part of that filter thusly not ( (src and dest) net localnet ) It's shorthand for not src net localnet and not dest net localnet
What does this tcpdump line means?
1,321,145,927,000
ls -lrt |grep 'Jun 30th' | awk '{print $9}' | xargs mv -t /destinationFolder I'm trying to move files from certain date or pattern or createuser. It doesn't work properly without the -t option. Could someone please enlighten on xargs -n and -t in move command?
From the mv man page -t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY mv's default behavior is to move everything into the last argument so when xargs executes the command it does it like mv /destinationFolder pipedArgs without the -t it would try to move everything into the...
What does '-t' do in mv command? Example below
1,321,145,927,000
I'm trying to build a comprehensive filter / exclude file, to prevent backuping stuff that doesn't make sense do backup, such as temporary / cache data or easily recreatable files. I would appreciate if you could share (part of) your exclude list for rsync backups. Here is what I have so far: ## Universal excludes l...
I usually also exclude: /etc/mtab /run/ /var/run/ /var/cache/pacman/pkg/ (on Arch Linux systems)
What do you filter / exclude list when doing backup with rsync? [closed]
1,321,145,927,000
[root@localhost ~]# ps aux | grep ata root 19 0.0 0.0 0 0 ? S 07:52 0:00 [ata/0] root 20 0.0 0.0 0 0 ? S 07:52 0:00 [ata_aux] root 1655 0.0 2.6 22144 13556 tty1 Ss+ 07:53 0:18 /usr/bin/Xorg :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-t1gMC...
With -d " ", the field separator is one (and only one) space character. Contrary to the shell word splitting, cut doesn't treat space any different than any other character. So cut -d " " -f2 returns "" in root   19, just like it would return "" for cut -d: -f2 in root:::19. You'd need to either squeeze the blanks to ...
not getting desired output with cut command?
1,321,145,927,000
I have a file in this format: [#] OWNER_NAME NAME SIZE [6] Robottinosino Software 200 [42] Robottinosino Ideas worth zero 188 [12] Robottinosino Ideas worth zero or more 111 [13] I am Batman Hardware 180 [25] Robottinosino Profile...
It's not like I haven't tried before asking... here's my attempt... but it looks way too complicated to me. Disregard the logic that handles dirty files gracefully, it was not part of the question and it's not the focus of the text look-up anyway. It just so happens that the files I have sometimes do not start with "H...
Text file look-up by column
1,321,145,927,000
I want to find all directories that are named Contents and then from the list of found results, I want to filter them and only include those that have a file named Database.json directly inside them. find / -type d -name Contents 2>/dev/null | while read dir; do if [ -f $dir/Database.json ]; then echo $dir...
With GNU find, you can do: LC_ALL=C find . -path '*/Contents/Database.json' -printf '%h\n' Where %h gives you the head of the path, that is the dirname. LC_ALL=C is needed for * to match any sequence of bytes regardless of what the user's locale regards as characters, as file paths can be made of any sequence of byte...
Find directories with name, but filter them if they contain a specific top-level file in them
1,321,145,927,000
How can I remove a single filter? tc filter show dev peth1 shows filter parent 1: protocol ip pref 16 u32 filter parent 1: protocol ip pref 16 u32 fh 800: ht divisor 1 filter parent 1: protocol ip pref 16 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:2 match 5bd6aaf9/ffffffff at 12 Why does that not work?: tc...
Old post, but for reference, it wouldn't work for a few reasons: The priority should be 16 and not 1 The filter handle should be 800::800 and not 800:800 You must supply the parent qdisc that the filter is attached to This should work: tc filter del dev peth1 parent 1: handle 800::800 prio 16 protocol ip u32
remove tc filter (Traffic Shaping)
1,321,145,927,000
I installed Getmail to retrieve emails from another email server and Procmail to filter the incoming emails. (I am running Debian/Squeeze.) The recipe I created has this code: :0: * ^[email protected] Xyz I thought this will make sure that all incoming emails will be saved in ~/Maildir/Xyz/ as individual files. Inste...
The top level of procmail recipes are reserved for assignment of procmail variables. Add the following to the top of your procmail recipe. MAILDIR="$HOME/Maildir/" When defining where the mail should be delivered, you have defined Xyz as a file, not a directory. It should instead read: :0: * ^[email protected] Xyz/ ...
Savings emails as individual files using Procmail