date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,472,759,778,000 |
Possible Duplicate:
Creating a UNIX account which only executes one command
I am trying to setup a user account that only has as minimal rights as possible.
The user should be able to log in via SSH and then use the "su" command to get root access BUT nothing else.
Is this even possible? So no basic commands like ... |
I would suggest allowing to connect only via public key. Then you can connect that public key with your own command by supplying it in ~/.ssh/authorized_keys like that:
command="/path/to/mycommand" ssh-rsa ...
Whenever the user logs into that account with that key your command is executed instead of the usual shell. ... | SSH minimal rights user - su only [duplicate] |
1,472,759,778,000 |
I'm setting up the *ARR suite apps in jails (using the Bastille manager). I used to do this in debian and docker but this time I moved to freeBSD to try out it's native zfs support.
In setting up I need to setup a uniform user, setup external mounts (the involved bit) and install the apps on each jail. I did this manu... |
The automation tool would be simple shell scripts or if you are already using Bastille you would create an equally simple template.
You can either do your actions from "outside" the jail by directly modifying the the filesystem running a script on the host system. Or you can do them running "within" the context of the... | Automate deploying a bunch of thin jails |
1,472,759,778,000 |
I'm trying to use FreeNAS on my office along with Syncthing, and some things are giving me headache.
FreeNAS installed Syncthing as a jail, and I did the jexec command to login into the jail, but now I can't figure out a way to login back into my server. I'm as root@syncthing instead of being in root@freenas. How do I... |
You were unable to just?
$ exit
| Logout from jail |
1,472,759,778,000 |
Jailed a user using https://olivier.sessink.nl/jailkit/ on Centos7
sudo jk_jailuser -m -j /home/jail -v -s /bin/bash testing
sudo jk_cp -v -f /home/jail /bin/bash
Then made /home/jail/home/testing 0777 so I can sftp as my username and get files. All working.
Then attempted to su testing as local user or attempted to... |
For security reasons ssh and jailkit do not allow writable root directory / and abort if they detect bad permissions.
For example if root is writable users could provide their own configuration files in /etc (and their own /etc/passwd) or their own dynamic libraries in /lib to abuse setuid binaries (or already running... | Why will shell automatically close for jailed user with 777 home? |
1,472,759,778,000 |
How can I run firejail as a root user?
# firejail --seccomp firefox
Reading profile /etc/firejail/firefox.profile
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-devel.inc
Error: --noroot option cannot be used when starting the s... |
Edit /etc/firejail/firefox.profile and comment or delete the noroot line
| How to run firejail as root? |
1,459,275,092,000 |
I work in a large office building with hundreds of other computers on the same LAN. I don't have any reason to communicate with most of these computers, and when I do, it's always on an "opt-in" basis (like adding a network mount to my fstab). But Linux Mint is automatically adding printers throughout the building, an... |
Stop the CUPS service (embodied by a process called cupsd), for example
sudo service cups stop
Open /etc/cups/cupsd.conf in your favorite editor, for example
sudo vim /etc/cups/cupsd.conf
Look if there is a line in this file saying
Browsing Yes
and change this line to
Browsing No
This should dis... | How can I limit engagement with a large office LAN? |
1,459,275,092,000 |
I used to be able to ssh [email protected] between machines on my LAN but it is no longer working. I can ssh using the IP of course, but it's DHCP so it may change from time to time. Both machines run Debian 9.12, one is a VM in a Windows host, but still, it DID work ; I haven't fooled around with the config files, ju... |
Found it !
It seems that my router has a DNS server indeed :
nslookup host_ip router_ip
Server: 192.168.1.254
Address: 192.168.1.254#53
69.1.168.192.in-addr.arpa name = hostname.lan.
So that answers the .localvs .lanquestion. In recent Debian, the local domain is .lan.
Still, ping hostname.lan returns unkno... | Can't resolve hostname.local on LAN |
1,459,275,092,000 |
How to disable LAN connection at startup in Debian Jessie? Ido not know what establishes that connection. Is it any configuration file or my wicd that starts on boot. But when I open wicd I can see that connection via the wire is established after system startup. I do not want this connection because the modem connect... |
These two lines define the actions to be applied to the eth0 interface:
allow-hotplug eth0
iface eth0 inet dhcp
The man page for interfaces (man interfaces) will describe it in glorious detail, but essentially, it's saying
If we have an eth0 interface, allow it to be defined
When we find eth0 bring it up with DHCP
... | Disable LAN connection at startup in Debian |
1,459,275,092,000 |
I have a newly built computer with MSI MEG X399 CREATION Motherboard, which includes two Ethernet ports with Intel i211 Gigabit Ethernet. I am running Debian 10, but the Ethernet doesn't work. I can't ping any host: sometimes the lights on the Ethernet plug become bright, sometimes they don't and I need to restart the... |
Well, I could resolve the problem. Running sudo ethtool -s enp8s0 speed 10 duplex half autoneg off I was able to get a connection (although slow and unstable). I figured out the problem was an ancient long CAT5 cable in the wall and potentially also the low quality router.
| Debian 10 intel i211 LAN not working |
1,459,275,092,000 |
As you may have heard, Microsoft announced that Windows 10 will allow you to download updates not just from their servers, but from multiple sources using peer-to-peer over LAN and the Internet.
My question is: Is there such feature that exists for Linux?
source: http://wccftech.com/windows-10-lets-updates-torrents/
|
To my knowledge no distro uses peer-to-peer for downloading packages. If you have lots of computers running the same Linux distribution most package management systems allow you to run your own repositories and mirrors. This is useful if you have a slow internet connection or if you have a very large amount of machine... | Download updates from peer computer over LAN |
1,459,275,092,000 |
For instance, if one wants to access the account bob on a machine on a local network behind a router, they would simply type:
$ ssh -p xx [email protected]`
However, how does ssh handle the possibility of two machines on the local network having the same username? Is there a flag to differentiate between user bob on ... |
Why would ssh care about reiterating usernames on different hosts? It is absolutely expected that this will happen. Hint: the root user is omnipresent, is it not?
So the answer to your questions is: ssh handles it the same way everything else would handle it: by not caring about which user is being referenced unti... | How does ssh handle 2 computers on the local network with the same username? |
1,459,275,092,000 |
There's a specific remote subdomain mymachine.home.com whose the IP changes on all the time that I need to update DNSMasq to have it resolve correctly.
But I tested pinging xxxxxx.home.com which doesn't exist and it all seems to want to point to my NginX reverse proxy. (A lot of my entries point there.)
How can I stop... |
The most common reason why you get a bogus IP address for a nonexistent domain is that your ISP converts negative answers into the address of their ad servers, to serve you more ads when you make a typo in the address of a website. This is definitely a shady practice, but unfortunately some ISPs do it.
You can commonl... | Dnsmasq points nonexistent subdomains point to local IP |
1,459,275,092,000 |
This is a equivalent question asked here for OSX. What is the easiest way to find out a NetBIOS name of a WIndows PC in my LAN by MAC address and vice versa?
It can be done by IP with:
nmblookup -A a.b.c.d
nmblookup pc_netbios_name
Is there a similar command for MAC address?
|
You can find out the MAC address of a recently contacted device by its IP address using the arp table:
ping -c1 -w1 10.0.2.2
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data.
64 bytes from 10.0.2.2: icmp_seq=1 ttl=63 time=0.785 ms
--- 10.0.2.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0... | How can I find out the name of a Windows PC on my LAN by MAC address? |
1,459,275,092,000 |
I'm using dnsmasq as a DNS server only (no dhcp), mapping Lan's hostnames to relative ip using /etc/hosts, but in the same Lan there's some ip assigned dynamically by a router (and I'd like to keep so, I don't want to use dnsmasq'd dhcp but I want to keep the ip dynamic).
Any way to map a MAC-address with a hostname s... |
Solved, see poor-mans-device-discovery-dns new link
Use dnsmasq's option addn-hosts=/etc/dyn.hosts to read an additional hosts file, which is generated periodically using the command arp-scan (and cron or whatever).
| dnsmasq as dns only, map mac-address to hostname for dynamic ip |
1,459,275,092,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,459,275,092,000 |
I am running a local network over a home router with dhcp enabled. So in case of any reboot of the router, my devices get some random IP within a given range. Is there any way to check the IPs of the other devices without getting into the router? like I have an app in my mobile named "Network scanner" which within a g... |
Sure you can.Just install nmap tool
yum install -y nmap
then run :
nmap -sn 10.42.0.0/24
Of course you'll need to replace the IP range with the appropriate values for your network.
| Is there any way to scan a lan network with dhcp enabled to see the IP of the connected devices from a GNU/Linux machine? |
1,459,275,092,000 |
I can connect to the Internet without a problem by using wireless networks.
I have a DSL connection on defined which can connect to the Internet when LAN is connected. When I plug-in network cable, network-manager icon keeps waiting for address from LAN and connecting DSL does nothing. What should I do?
Output of ifco... |
It looks like your cabled connection is not obtaining an IP address from the DSL connection.
This can be either because there is no DHCP server running on the network you are connecting to or because the interface is not properly configured.
Try doing the following:
Install the ifupdown-extra package, (as root): ap... | Debian Jessie: My LAN is not working! |
1,459,275,092,000 |
I just set up my raspberry pi. It is working great and I can easily access it from my local Windows machine using SSH. I gave it a custom hostname. I can acces the pi with this hostname only when the samba server is running on the pi. When I stop it I can no longer use the custom hostname and have to use the IP.
I was... |
You can either setup a DNS server and add an entry for your Pi's hostname + IP to it. All the systems that need resolve this hostname will need to make use of this DNS server.
Your other option is to add an entry in your system's hosts file with an entry that specifies the Pi's hostname + IP address.
1.2.3.4 pi-host
... | Create FQDN in LAN for Windows systems without samba |
1,459,275,092,000 |
I'm really new in all of this, and I'm not really sure of how to do that, but I have an HDD connected to the LAN; from Windows, I run:
net use y: \\192.168.1.200\my-path\ condor /user:admin
I'm trying to do the same on Linux, "translating" the line above to work on my Fedora, but I'm not really sure on how to do it. ... |
You could install Gigolo and see what it returns. Gigolo is a graphical utility for the virtual filesystem GIO/GVfs which manages files over a TCP/IP network.
I think there's even a package for Fedora, in which case you can install it via
yum install gigolo
Here's its manpage.
| mount lan hdd into linux fedora |
1,459,275,092,000 |
I am running a RPi 4b with Raspbian (Bullseye), Logitech Media Server (LMS) 8.2.0 and Squeezelite 1.9.9. For automated startup of the Squeezelite process whenever a certain USB device is connected, I have defined the following udev rules:
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="154e... |
As already suggested by @dirkt, starting Squeezelite by udev as a process is not a good idea: LAN access under udev is somehow limited, and the process will get killed after some time anyway. It is the preferred way to start Squeezelite as a service.
To do so, the udev rules need to be defined as follows:
# cat /etc/u... | udev without LAN access? |
1,459,275,092,000 |
I have 2 computers PC1 and PC2
1) PC1 can't boot from CD-ROM or USB, the only way is to boot from LAN
2) PC2 is runing debian jessie (which I want to use as server) and contains the Iso image debian8.iso,
How to install debian jessie on my PC1 through LAN using the debian8.iso ?
|
You could build a PXE Boot server. You can do this using several operating systems, including Debian.
PC2 is configured as a PXE Boot server, potentially using resources from the ISO image. PC1 is then configured in the BIOS to boot from those resources.
There's a lot of stuff required on PC2 to support this, and PC... | How to install debian through LAN? |
1,459,275,092,000 |
We have a number of linux devices, each living in its own LAN (each LAN with its own router, connected to internet). Each device can connect to internet but cannot be directly reached (i.e. no public ip address, no possibility to configure the router to forward incoming traffic). We are on public infrastructures using... |
Provided you can get at least one central system that is internet routable, you might try tinc. It's a bare-bones minimalistic mesh-style VPN with very low overhead and reasonably good security. Provided you're not constantly saturating the link, it's sufficiently light-weight to run with no issues on an AWS EC2 t2.... | virtual WAN for devices in different LANs |
1,459,275,092,000 |
I wanted to assign Unique Local Addresses (ULA) to a couple of machines inside my LAN alongside the link-local ones and the globally routable ones. I am currently running dual stack. I also wanted to keep them short, like fd69:6666::.
One machine is running Debian Jessie (kernel 3.16.0-4-amd64) and the other one Linux... |
Try using fd69::6666 instead. Using fd69:6666:: only sets the network part of the address. Remember to change the netmask too! This should be the result:
/etc/network/interfaces
auto eth0
iface eth0 inet6 static
address fd69::6666
netmask 64
| Cannot make ipv6 ULA addresses work |
1,459,275,092,000 |
My question regards ssh, sftp, scp, rsync, etc. commands where you connect to another machine which can be in your Local Area Network (LAN) or at some remote location you would typically connect via the Wide Area Network (WAN) or greater internet.
For instance, if you were to use these each of these two commands,
ssh ... |
First your router is not just a router, it is also a ethernet switch, a DHCP server, A wifi hotspot, a modem, …
2nd it should be routed the best way: if on same sub-net 192.168.0.x then it will be routed by the machines, and not go through the router (not the router part of the router, just the ethernet switch).
What ... | If you ssh to another device in your LAN, can you accidentally connect through a less direct pathway (WAN)? |
1,459,275,092,000 |
I have installed LAN messenger on linux mint.
It was installed successfully but was not running.
So I have tried "sudo lmc" in terminal and than it gave the following error in a popup window:
A port address conflict has been detected. LAN Messenger will close now.
|
The following command in terminal worked for me.
lmc /noconfig
| A port address conflict has been detected. LAN Messenger will close now |
1,540,996,919,000 |
On separate machine Ive setup some www server based on Debian 8 for testing purposes. It has also samba and GIT server installed. Today we got public ip from our ISP and i redirected port :80 to our LAN machine server.
LAN SERVER [*.*.0.200:8010] <= INSIDE ROUTER [*.*.1.100] (:80 redirection to *.0.200:8010 ) <= OUTS... |
Ok my idea was wrong because i havent fully undestand how VPNs work. Especially the fact that OpenVPN creates its own interface so there is no need to create another one. I went trough all tutorial like it was written, only changing minor things and it worked.
I reccomend Hak5 video which is very similar , or (strange... | Securing LAN www server with OpenVPN? |
1,540,996,919,000 |
I have connected 2 PCs using ethernet cable and set up FTP on one of them to transfer some >100GB of files. However, trying to download it, I run into a problem of speed not more than 50kB/s. It happens whether I download through Nautilus or Filezilla.
However, if I try to download a large file using Google Chrome, i... |
I found it. The problem was far not in the connection, it is in the file system. I was trying to copy from NTFS to NTFS. When I formatted the receiving FS to ext4, speed increased to 40+MB/sec.
| Super-slow LAN speed, unless downloading through Chrome's FTP client [closed] |
1,540,996,919,000 |
BACKGROUND DETAILS:
I've inhereted a QNAP TS-459U-RP.
I currently have it connected to my home router via an ethernet/rj45 cable. My computer is connected to the same router. How do I access the QNAP from my computer?
If I open nautilus and go to + Other Locations, I now see 2 new options under Networks which only ... |
You need to configure the QNAP using its web GUI. There are lots of manuals, tutorials, etc. at https://qnap.com. Default username is admin, possibly with password admin.
To find its IP address you can either use the QNAP Finder tool (Windows, downloadable from QNAP's website), or look at whatever issues DHCP addresse... | How do I connect to a QNAP [closed] |
1,540,996,919,000 |
I have two network interfaces on a client PC, one wired, one wireless. The
wired is connected directly to a server PC running DHCP, which gives the
client PC a 10.0... address. The client PC also connects to a wireless
router, which gives it a 192.168... address. This was all set up and
detected automatically by Netwo... |
Ok, I figured it out by looking at the answer to this question:
NetworkManager changes default routing policy
To summarize:
Open up NetworkManager's graphical connection editor
$ nm-connection-editor
In the GUI:
Click on "Wired connection 1".
Click on the gear button for settings.
Click on the "IPv4 Settings" tab.
Cl... | Set up wired ethernet LAN to coexist with wireless WAN using NetworkManager |
1,540,996,919,000 |
I'm running the latest version of Pop! Os.
I have a laptop connected to my main computer via an ethernet cable.
The laptop IP is 169.254.83.40 and my main computer IP is 169.254.83.50 on the connected interface. My wifi interface is 192.168.0.20 on the main computer.
When I am connected to wifi and I attempt to ping m... |
The reason that you are seeing this is that the wifi connection added a route that was more specific than the one on your wired connection (I've notated the important stuff with asterisks):
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG... | When connected to Wifi I am unable to ping directly connected computer |
1,540,996,919,000 |
I have a measurement device (an Agilent frequency counter) that I want to communicate with directly via it's LAN interface. However, my Ubuntu 20.04 laptop does not seem to want to establish a connection. I'm afraid there is some basic networking concept that I am not applying.
What I've tried: I've tested the device'... |
Turn DHCP off on your device, and assign the device the address 192.168.2.2 with subnet 255.255.255.0 and gateway 192.168.2.1. Then on your Ubuntu machine, create a new manual connection without dhcp for your Ethernet port, and set the address to 192.168.2.3, with subnet 255.255.255.0 and gateway 192.168.2.1. You shou... | Trouble connecting to a LAN device |
1,540,996,919,000 |
what is the advantage to configure the network with UUID?
uuidgen eno093736
1b64d026-c6a6-447c-85aa-40c5d2db2c4e
for example we want to configure BOND under /etc/sysconfig/network-script
what is the positive thing that we configure the BOND with UUID?
UUID=ef23ca7b-93d6-4b40-9fa0-4a9b208914e50
|
that`s because if you scan your NIC ports again or update your OS, the device names may change. its like filesystems. in fstab you should always enter uuid of LUN because sometimes after a reboot the lun names will change. but uuids of ports or LUNs never change.
| what is the advantage to configure the network ETH with UUID? |
1,540,996,919,000 |
I removed gnome(running bare openbox)and now lan and wlan both do not work anymore.
I used this to set up my wifi before, but now it does not work anymore and insmod tells that the file already exists, even though I did not insert the module yet:
How to check if USB WiFi-Adapter is not working or router is out of rang... |
Check all interfaces by running ifconfig -a and then run ifup command on disabled interfaces, e.g. ifup eth0
| No internet connection after uninstalling gnome [Fedora + Openbox] |
1,540,996,919,000 |
My goal is to setup a firewall & Intrusion Prevention system using Snort. I have a spare pc available with at least 2 physical NIC's, which ran pfSense having a firewall with Snort, but this time I want to do the setup myself.
So far I managed to install Debian 9 as a headless system with ssh login (and if really need... |
Seems I’ve found a working solution... maybe trivial once you know it, but keep in mind I didn’t know linux nor much networking. So, here.s what I learned:
- you need to use a bridge if you want ‘plug&play’, because it just passes trafic. You could setup a router, but then what comes behind the firewall, needed a diff... | How to setup a firewall between my ISP cable modem/router and my LAN? |
1,327,678,484,000 |
A huge (up to 2 GiB) text file of mine contains about 100 exact duplicates of every line in it (useless in my case, as the file is a CSV-like data table).
What I need is to remove all the repetitions while (preferably, but this can be sacrificed for a significant performance boost) maintaining the original sequence or... |
An awk solution seen on #bash (Freenode):
awk '!seen[$0]++' filename
If you want to edit the file in-place, you can use the following command (provided that you use a GNU awk version that implements this extension):
awk -i inplace '!seen[$0]++' filename
| How to remove duplicate lines inside a text file? |
1,327,678,484,000 |
Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010).
From what I understand I can do this by piping head into tail or viceversa, i.e.
head -A /path/to/file | tail -B
or alternatively
tail -C /path/to/file | head -D
where A,B,C and D can be computed from the number ... |
I suggest the sed solution, but for the sake of completeness,
awk 'NR >= 57890000 && NR <= 57890010' /path/to/file
To cut out after the last line:
awk 'NR < 57890000 { next } { print } NR == 57890010 { exit }' /path/to/file
Speed test (here on macOS, YMMV on other systems):
100,000,000-line file generated by seq... | cat line X to line Y on a huge file |
1,327,678,484,000 |
I have a huge (70GB), one line, text file and I want to replace a string (token) in it.
I want to replace the token <unk>, with another dummy token (glove issue).
I tried sed:
sed 's/<unk>/<raw_unk>/g' < corpus.txt > corpus.txt.new
but the output file corpus.txt.new has zero-bytes!
I also tried using perl:
perl -pe... |
The usual text processing tools are not designed to handle lines that don't fit in RAM. They tend to work by reading one record (one line), manipulating it, and outputting the result, then proceeding to the next record (line).
If there's an ASCII character that appears frequently in the file and doesn't appear in <unk... | Replace string in a huge (70GB), one line, text file |
1,327,678,484,000 |
I have a fairly large file (35Gb), and I would like to filter this file in situ (i.e. I don't have enough disk space for another file), specifically I want to grep and ignore some patterns — is there a way to do this without using another file?
Let's say I want to filter out all the lines containing foo: for example..... |
At the system call level this should be possible. A program can open your target file for writing without truncating it and start writing what it reads from stdin. When reading EOF, the output file can be truncated.
Since you are filtering lines from the input, the output file write position should always be less than... | Is there a way to modify a file in-place? |
1,327,678,484,000 |
I have two big files (6GB each). They are unsorted, with linefeeds (\n) as separators. How can I diff them? It should take under 24h.
|
The most obvious answer is just to use the diff command and it is probably a good idea to add the --speed-large-files parameter to it.
diff --speed-large-files a.file b.file
You mention unsorted files so maybe you need to sort the files first
sort a.file > a.file.sorted
sort b.file > b.file.sorted
diff --speed-large-... | Diffing two big text files |
1,327,678,484,000 |
I tried it with SCP, but it says "Negative file size".
>scp matlab.iso xxx@xxx:/matlab.iso
matlab.iso: Negative file size
Also tried using SFTP, worked fine until 2 GB of the file had transferred, then stopped:
sftp> put matlab.iso
Uploading matlab.iso to /home/x/matlab.iso
matlab.iso ... |
The original problem (based on reading all comments to the OP question) was that the scp executable on the 64-bit system was a 32-bit application. A 32-bit application that isn't compiled with "large-file support" ends up with seek pointers that are limited to 2^32 =~ 4GB.
You may tell if scp is 32-bit by using the fi... | Transferring large (8 GB) files over ssh |
1,327,678,484,000 |
Is useful to use -T largefile flag at creating a file-system for a partition with big files like video, and audio in flac format?
I tested the same partition with that flag and without it, and using tune2fs -l [partition], I checked in "Filesystem features" that both have "large_file" enabled. So, is not necessary to ... |
The -T largefile flag adjusts the amount of inodes that are allocated at the creation of the file system. Once allocated, their number cannot be adjusted (at least for ext2/3, not fully sure about ext4). The default is one inode for every 16K of disk space. -T largefile makes it one inode for every megabyte.
Each file... | largefile feature at creating file-system |
1,327,678,484,000 |
I have a few files sized > 1 GB each. I need to remove last few bytes from the files. How can I do it? I prefer to edit file in place to save disk space.
I am on HP-UX.
|
Try using hexedit I haven't tried it on HP-UX but it should work. It allows you to move to a location in a file and truncate. I'm pretty sure that it does not read the whole file in but just seeks to the appropriate location for display.
Usage is fairly simple once you have launched it the arrow keys allow you to move... | How can I edit a large file in place? |
1,327,678,484,000 |
I have a 900GB ext4 partition on a (magnetic) hard drive that has no defects and no bad sectors. The partition is completely empty except for an empty lost+found directory. The partition was formatted using default parameters except that I set the number of reserved filesystem blocks to 1%.
I downloaded the ~900MB fil... |
3 or 4 fragments in a 900mb file is very good. Fragmentation becomes a problem when a file of that size has more like 100+ fragments. It isn't uncommon for fat or ntfs to fragment such a file into several hundred pieces.
You generally won't see better than that at least on older ext4 filesystems because the maximum ... | Why are these files in an ext4 volume fragmented? |
1,327,678,484,000 |
I have a directory with about 100000 small files (each file is from 1-3 lines, each file is a text file). In size the directory isn't very big (< 2GB). This data lives in a professionally administered NFS server. The server runs Linux. I think the filesystem is ext3, but I don't know for sure. Also, I don't have root ... |
As you surmise, it does depend on many things, mostly the filesystem type and options and to some extent the kernel version. In the ext2/ext3/ext4 series, there was a major improvement when the dir_index option appeared (some time after the initial release of ext3): it makes directories be stored as search trees (loga... | Number of files per directory |
1,327,678,484,000 |
I have a log of 55GB in size.
I tried:
cat logfile.log | tail
But this approach takes a lot of time. Is there any way to read huge files faster or any other approach?
|
cat logifle.log | … here is superfluous, and actually contributes to it being slow. tail logfile.log without the cat would make a lot more sense!
It's going to be much faster, because when the input is not seekable, what tail needs to do is read all the standard input, line by line, keep the last 10 lines around in a ... | How do I read the last lines of a huge log file? |
1,327,678,484,000 |
I have ~30k files. Each file contains ~100k lines. A line contains no spaces. The lines within an individual file are sorted and duplicate free.
My goal: I want to find all all duplicate lines across two or more files and also the names of the files that contained duplicated entries.
A simple solution would be this:
c... |
Since all input files are already sorted, we may bypass the actual sorting step and just use sort -m for merging the files together.
On some Unix systems (to my knowledge only Linux), it may be enough to do
sort -m *.words | uniq -d >dupes.txt
to get the duplicated lines written to the file dupes.txt.
To find what fi... | How to find duplicate lines in many large files? |
1,327,678,484,000 |
I have a 250 MB text file, all in one line.
In this file I want to replace a characters with b characters:
sed -e "s/a/b/g" < one-line-250-mb.txt
It fails with:
sed: couldn't re-allocate memory
It seems to me that this kind of task could be performed inline without allocating much memory.
Is there a better tool for ... |
Yes, use tr instead:
tr 'a' 'b' < file.txt > output.txt
sed deals in lines so a huge line will cause it problems. I expect it is declaring a variable internally to hold the line and your input exceeds the maximum size allocated to that variable.
tr on the other hand deals with characters and should be able to handle ... | Basic sed command on large one-line file: couldn't re-allocate memory |
1,327,678,484,000 |
In the same spirit as this other question: cat line X to line Y on a huge file:
Is there a way to open from within Emacs (and
show on a buffer) a given set of lines (e.g. all lines between line X and Y) from a huge text file?
E.g. Open and show in a buffer all lines between lines 57890000 and 57890010 from file huge... |
If you want to open the whole file (which requires ), but show only part of it in the editor window, use narrowing. Select the part of the buffer you want to work on and press C-x n n (narrow-to-region). Say “yes” if you get a prompt about a disabled command. Press C-x n w (widen) to see the whole buffer again. If you... | Emacs: Open a buffer with all lines between lines X to Y from a huge file |
1,327,678,484,000 |
we would like to understand copytruncate before rotating the file using logrotate with below configuration:
/app/syslog-ng/custom/output/all_devices.log {
size 200M
copytruncate
dateext
dateformat -%Y%m%d-%s
rotate 365
sharedscripts
compress
postrotate
/app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
... |
Truncating a logfile actually works because the writers open the files for writing using O_APPEND.
From the open(2) man page:
O_APPEND: The file is opened in append mode. Before each write(2), the
file offset is positioned at the end of the file, as if with lseek(2).
The modification of the file offset and the wr... | How copytruncate actually works? |
1,327,678,484,000 |
I need to copy one very large file (3TB) on the same machine from one external drive to another. This might take (because of low bandwidth) many days.
So I want to be prepared when I have to interrupt the copying and resume it after, say, a restart.
From what I've read I can use
rsync --append
for this (with rsync v... |
Do I use rsync --append for all invocations?
Yes, you would use it each time (the first time there is nothing to append, so it's a no-op; the second and subsequent times it's actioned). But do not use --append at all unless you can guarantee that the source is unchanged from the previous run (if any), because it tur... | Is rsync --append able to resume an interrupted copy process without reading all the copied data? |
1,327,678,484,000 |
I have a large folder with 30M small files. I hope to backup the folder into 30 archives, each tar.gz file will have 1M files. The reason to split into multi archives is that to untar one single large archive will take month.. pipe tar to split also won't work because when untar the file, I have to cat all archives to... |
I wrote this bash script to do it.
It basically forms an array containing the names of the files to go into each tar, then starts tar in parallel on all of them.
It might not be the most efficient way, but it will get the job done as you want.
I can expect it to consume large amounts of memory though.
You will need to... | how to create multi tar archives for a huge folder |
1,327,678,484,000 |
I need to view a large (50000x40000 px) png image on Linux. Unfortunately most tools (eog, convert etc.) either crashes or fail with note about too little memory.
Is there a way to view this image (I would prefer to see both the resized image and details)?
|
I would try viewing it in gimp. Should be in your distros' repositories, main website's here. Lots of tutorial are available through a simple google search.
When I tried to open your image size I needed to up Gimp's default paging limit so that it could accommodate it. It's under the menu Edit -> Preferences:
... | Viewing large image on Linux |
1,327,678,484,000 |
Here is what I do right now,
sort -T /some_dir/ --parallel=4 -uo file_sort.csv -k 1,3 file_unsort.csv
the file is 90GB,I got this error message
sort: close failed: /some_dir/sortmdWWn4: Disk quota exceeded
Previously, I didn't use the -T option and apparently the tmp dir is not large enough to handle this. My current ... |
The problem is that you seem to have a disk quota set up and your user doesn't have the right to take up so much space in /some_dir. And no, the --parallel option shouldn't affect this.
As a workaround, you can split the file into smaller files, sort each of those separately and then merge them back into a single fil... | Sort large CSV files (90GB), Disk quota exceeded |
1,327,678,484,000 |
I have two partial disk images from a failing hard drive. File B contains the bulk of the disk's contents, with gaps where sector reads failed. File A is the result of telling ddrescue to retry all the failed sectors, so it is almost entirely gaps, but contains a few places where rereads succeeded. I now need to me... |
Your algorithm is implemented in GNU dd.
dd bs=512 if=A of=B conv=sparse,notrunc
Please verify this beforehand with some test files of your choice. You don't want to inadvertently damage your File B. A better algorithm would be to check whether B also has zeroes at that position, alas that's something dd does not do.... | Merge nonzero blocks of huge (sparse) file A into huge file B |
1,327,678,484,000 |
How do I delete this large directory?
stat session/
File: ‘session/’
Size: 321540096 Blocks: 628040 IO Block: 4096 directory
Device: 903h/2307d Inode: 11149319 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-09-29 14:34:40.910894275 +0200
Modify: 2... |
Solved: 4 days later the rsync finished the job - all files have been deleted - but it needed at least 2 days to read directory info, before deleting a single file.
This is information for anyone who might have a similar problem: use screen and be patient.
| Delete huge directory that causes all commands to hang |
1,327,678,484,000 |
I have a large tar file (60GB) containing image files. I'm using mmap() on this entire file to read in these images, which are accessed randomly.
I'm using mmap() for the following reasons:
Thread safety -- I cannot seek an ifstream from multiple threads.
I can avoid extra buffering.
I get some caching (in the form o... |
A read-only mmap is largely equivalent to open followed by lseek and read. If a chunk of memory that's mapped in a process is backed up by a file, the copy in RAM is considered part of the disk cache, and will be freed under memory pressure, just like a disk cache entry created by reading from a file.
I haven't checke... | Behavior of mmap'd memory on memory pressure |
1,327,678,484,000 |
I have FILE_A which has over 300K lines and FILE_B which has over 30M lines.
I created a bash script that greps each line in FILE_A over in FILE_B and writes the result of the grep to a new file.
This whole process is taking over 5+ hours.
I'm looking for suggestions on whether you see any way of improving the perform... |
The key to performance is reading the huge file only once.
You can pass multiple patterns to grep by putting them on separate lines. This is usually done by telling grep to read patterns from a file:
grep -F -f 300KFile 30MFile
This outputs the matches in the order of the large file, and prints lines that match multi... | Grepping over a huge file performance |
1,327,678,484,000 |
I'm looking for an editor that will open the file in chunks (not try to read the whole file into memory) as I'm trying to hand-edit a 200G file.
|
This may not be exactly what you're looking for, but hexedit will open large files like that. It only has what's displayed in the buffer (and maybe a little bit more) in memory. It's made for editing raw disk files (e.g., /dev/sda) and will display in hex side by side with ASCII or EBCDIC.
| What linux editor can open a 200G file for editing within a minute or two? |
1,327,678,484,000 |
I have a file that is 12 GB that I am trying to copy from a MacBook Air to a Debian computer, using a USB. I tried formatting the USB in many different ways, such as NTFS, FAT32, OS X Journalizing but either the MacBook Air complained it couldn't copy such a large file, it only had read-only access, or when I formatte... |
hfs+ can handle large files, and it has write support by Linux.
Although MacOS has only readonly NTFS support, there are third-party tool for read-write operations with it.
You can use split to split a large file into smaller ones. You can later unsplit them with cat. To have a better command line than the MacOS give... | What filesystem allows transferring files between Linux and OS X? |
1,327,678,484,000 |
Access logs are more or less sorted by time, but to aggregate connections by time (uniq -c), you need to sort them a bit more. For a huge access log sort is very inefficient, because it buffers and sorts the whole file before printing out anything.
Do you know any option for sort or version of sort, that could sort o... |
Try split --filter:
split --lines 1000 --filter 'sort ... | sed ... | uniq -c' access.log
This will split access.log into chunks of 1000 lines and pipe each chunk through the given filter.
If you want to save the results for each chunk separately, you can use $FILE in the filter command and possibly specify a prefix ... | how to sort access log efficiently in blocks |
1,327,678,484,000 |
This is a follow up question from Sort large CSV files (90GB), Disk quota exceeded.
So now I have two CSV files sorted, as file1.csv and file2.csv
each CSV file has 4 columns, e.g.
file 1:
ID Date Feature Value
01 0501 PRCP 150
01 0502 PRCP 120
02 0501 ARMS 5.6
02 0502 ARMS 5.6
file 2:
ID Date Feature Val... |
Let's review tools that combine two files together line by line in some way:
paste combines two files line by line, without paying attention to the contents.
comm combines sorted files, paying attention to identical lines. This can weed out identical lines, but subsequently combining the differing line would require ... | diff two large CSV files (each 90GB) and output to another csv |
1,327,678,484,000 |
Essentially, I'm hoping someone with an advanced knowledge of tar/bz2 can answer whether this is possible.
The situation is that we have a periodic 24GB feed of data from a vendor, as a .tbz file. (tar+bzip2). This is downloaded from the vendor via curl. To dramatically speed up this slow process, I'd like to obtain:
... |
No.
Tar is a concatenation of files data, interleaved with files metadata (tar headers). That alone wouldn't necessarily be the dead end, since one could read the header, find out data length and (if the server allowed for that) skip to the next header (e.g. via the same functionality that allows to resume HTTP transm... | Is it possible to get file list, byte range from the head of a tar+bzip2 file? |
1,327,678,484,000 |
I am currently trying to remove all newlines that are not preceded by a closing parenthesis, so I came up with this expression:
sed -r -i -e ":a;N;$!ba;s/([^\)])\n/\1/g;d" reallyBigFile.log
It does the job on smaller files, but on this large file I am using (3GB), it works for a while then returns with an out of memo... |
Your first three commands are the culprit:
:a
N
$!ba
This reads the entire file into memory at once. The following script should only keep one segment in memory at a time:
% cat test.sed
#!/usr/bin/sed -nf
# Append this line to the hold space.
# To avoid an extra newline at the start, replace instead of append.
1h
... | Out of memory while using sed with multiline expressions on giant file |
1,327,678,484,000 |
The default reserved blocks percentage for ext filesystems is 5%. On a 4TB data drive this is 200GB which seems excessive to me.
Obviously this can be adjusted with tune2fs:
tune2fs -m <reserved percentage> <device>
however the man page for tune2fs states that one of the reasons for these reserved blocks is to avoi... |
The biggest problem with fragmentation is free space fragmentation, which means that when your filesystem gets full and there are no longer big chunks of free space left, your filesystem performance falls off a cliff. Each new file can allocate only small chunks of space at a time, so is very fragmented. Even when o... | Recommended maximum percentage to fill a large ext4 data drive |
1,327,678,484,000 |
The GNU parallel grepping n lines for m regular expressions example states the following:
If the CPU is the limiting factor parallelization should be done on
the regexps:
cat regexp.txt | parallel --pipe -L1000 --round-robin grep -f - bigfile
This will start one grep per CPU and read bigfile one time per CPU,
bu... |
It is due to GNU Parallel --pipe being slow.
cat bigfile | parallel --pipe -L1000 --round-robin grep -f regexp.txt -
maxes out at around 100 MB/s.
In the man page example you will also find:
parallel --pipepart --block 100M -a bigfile grep -f regexp.txt
which does close to the same, but maxes out at 20 GB/s on a ... | GNU Parallel - grepping n lines for m regular expressions |
1,327,678,484,000 |
I am currently using rsync to copy a 73GB file from a Samsung portable SSD T7 to an HPC cluster.
rsync -avh path/to/dataset [email protected]:/path/to/dest
The following applies:
My local machine (where my T7 is connected) is a VirtualBox VM running Ubuntu 20.
The T7 transfer speeds should be up to approx. 1000MB/s.... |
You say that,
Your network speed is approximately 8 Mb/s.
Your rsync runs at about 1-5 MB/s.
Given that 1 MB/s is approximately 10 Mb/s I'd say that rsync is doing you a big favour.
Me, I'd probably have added compression with -z, and since you're using rsync with sensible flags over a network connection it's probab... | Is cp faster than rsync during the first run? |
1,327,678,484,000 |
How can I edit a really big file with vi? e.g.: a 20 GByte log file. Are there any modifications for it to handle this size?
|
If you're using Vim on a 32-bit system, I don't think there is a way to make it do this. It has a hard file size limit based on the size of a 32-bit integer.
If you can do your editing on a 64-bit system, Vim's file size limit becomes something in the exabytes range.
Vim also has an arbitrary lower limit, over which i... | Edit really big files with vi |
1,327,678,484,000 |
My Uni account is over disk quota and requesting more quota takes time. Unfortunately, I need disk space now and I noticed that the Trash file in my home directory is quite a large file.
I’m assuming that this somehow relates to my mail inbox? (I do have some doubts, since although his file clearly contains email mess... |
This Trash file is unrelated to Postfix. It's also probably not what you see over IMAP: while the IMAP server could be configured to serve this file as a mail folder called Trash, it's likely that it's showing a directory called Trash near other directories that you see over IMAP.
The mail you show is an oddity of Pin... | Can I safely delete ~/Trash file? |
1,327,678,484,000 |
I have a file that is roughly 30GB. I am using,
awk ' $1 <= 2000 ' myfile.txt >> myfile_new.txt
But, I get this error after a while -
awk: read error (Bad address)
I guess this is because the file is too large. Is there any way to get past this? How else can I do this?
What I need to do is quite simple, I have to... |
You're probably using mawk, which has some optimisations that can result in errors like this when dealing with particularly large data. gawk will likely not have these issues when running it in the same way.
| awk read error bad address |
1,389,235,186,000 |
As I know, the last command shows recent logins by all users. But my PC (CentOS) has been used for roughly a year, and there are many users logged. I tried to used the last command, but it just showed from June 2013 to September 2013.
My question is: how can I show the latest users that have logged in recently, say (... |
last reads from a log file, usually /var/log/wtmp and prints the entries of successful login attempts made by the users in the past. The output is such that the last logged in users entry appears on top. In your case perhaps it went out of notice because of this.
In order to check when was the file /var/log/wtmp was w... | "Last" command: How to show latest user login? |
1,389,235,186,000 |
As I was investigating a server that is rebooting in a regular fashion, I started looking through the "last" utility but the problem is that I am unable to find what the columns mean exactly. I have, of course, looked through the man but it does not contain this information.
root@webservice1:/etc# last reboot
reboo... |
I guess this is a three year old post, but I'll respond anyway, for the benefit of anyone else who happens across it in the future, like I just did recently.
From reading other posts and monitoring the output myself over a period of time, it looks like each line lists the start date and time of the session, the end ti... | Meanings of the columns in "last" command |
1,389,235,186,000 |
Can anybody explain me what is the meaning of the last column of the output of the last command? I'm particularly interested in its meaning with respect to the reboot pseudo-user.
reboot system boot 2.6.32-28-generi Sat Feb 12 08:31 - 18:09 (9+09:37)
What does that 9+09:37 mean?
|
reboot and shutdown are pseudo-users for system reboot and shutdown, respectively. That's the mechanism for logging that information, with kernel versions to same place, without creating any special formats for the wtmp binary file.
Quote from man wtmp:
The wtmp file records all logins and logouts. Its format is exa... | Output of the "last" command |
1,389,235,186,000 |
Last shows "crash" at 12:02 and 14:18, but the system didn't stop working at that time. The reboot at 15:03, on the other hand, was to recover from an actual crash - our system stopped responding at 14:46. Why does last show two "crashes" prior to the actual crash of the machine?
[admin@devbox log]$ last | head
myuse... |
last prints crash as the logout time when there is no logout entry in the wtmp database for a user session.
The last entry in last output means that myuser logged in on pts/0 at 12:02 and, when the system crashed between 14:18 and 15:03, that user should be still logged in.
Usually, in wtmp there are two entries for e... | Can't explain "crash" entries in output of the 'last' command |
1,389,235,186,000 |
In Mac OS X, if I don't touch it for a while, it will lock the screen and one must use password to unlock it, but this kind of log in is not recorded by last command. I want to know if anybody tried to break into my MacBook when I am not in front of it. Is there any way I can log such attempts?
|
If you suspect that someone has correctly guessed your password and got in, you can check this via the Console. To access Console press ⌘+space and type 'console' in the Spotlight box that appears. Click return.
Click on 'Diagnostic and Usage Messages' on the left panel. At the time of the correct login attempt you se... | How to know when and which user logged into the system under Mac OS X? Last is not enough! |
1,389,235,186,000 |
What can be a reason for last -x reboot showing two last entries as still running? Besides, I'm pretty sure I did not reboot this server December, 16, though it could be something with power on hosting provider. If that was the case, would this be expected result?
root@cthulhu-new ~ # last -x reboot
reboot system bo... |
Yes, it would be the expected result. last doesn’t know that your system was shut down on December 16, presumably because it wasn’t an orderly shut down (power loss or something like that). Because of the way it displays boots, it considers that the last two boots are still running.
Things will sort themselves out to ... | Debian - two entries in `last reboot` in `still running` |
1,389,235,186,000 |
I have a problem, like I need to find the directories that got updated yesterday. I tried using find command but its listing all the files that got updated in the directories. But I need only the directory names.
|
You can use -type d in the find string:
find /path/to/target -type d -mtime 1
| How to find Directories that updated last day in linux? |
1,389,235,186,000 |
I have notebook and want to store information for every day, when computer is running or not (with precise to minutes).
Here is output from last command:
dima tty1 :0 Sat Apr 14 21:56 gone - no logout
reboot system boot 4.15.15-1-ARCH Sat Apr 14 21:56 still running
root tty2 ... |
If systemd is your init system, then you can see it in that manner (works from root only):
[root@centos7 src]# journalctl -t systemd-sleep
-- Logs begin at Sat 2018-04-14 23:06:52 MSK, end at Sun 2018-04-15 01:30:01 MSK. --
Apr 15 00:18:55 centos7.localdomain systemd-sleep[3365]: Suspending system...
Apr 15 00:23:14 c... | How to make `last` shows also suspend/resume times? |
1,389,235,186,000 |
I see a suspicious pattern in a last command output on RHEL:
$ last reboot
reboot system boot 3.10.0-514.21.1. Wed Dec 13 10:25 - 11:53 (01:28)
reboot system boot 3.10.0-514.21.1. Mon Oct 30 16:23 - 11:53 (43+20:30)
reboot system boot 3.10.0-514.21.1. Fri Oct 20 16:53 - 11:53 (53+20:00)
reboot syst... |
When listing reboots, the tenth column shows the last “down time” following the boot, i.e. the time at which the system was shut down, as far as last can determine. This actually involves combining multiple records from the information stored in the system; to do so, last keeps track of the last down time it’s seen, a... | What is the purpose of the 10th column of the `last` command's output? |
1,389,235,186,000 |
I was looking into: 'last -d' command.
-d: For non-local logins, Linux stores not only the host name of the remote host but its IP number as well. This option translates the IP number back into a hostname.
At first, I was looking at similar questions, This one in particular:
'last -d' is REALLY slow
Before I updated ... |
According to man last, my Arch Linux system stores login info in /var/log/wtmp. It looks to be in a binary format - that is, the usual text tools will only show you parts of it.
This command: xxd /var/log/wtmp | more shows me both text-format dotted-quad IP addresses, and fully-qualified DNS names.
I wrote the followi... | Where does 'last' store user hostnames? |
1,389,235,186,000 |
I just found some odd behaviour on one of our servers that I can't explain myself.
It is about both middle lines. I would assume that the timespans for the boot user must not overlap, however, they do:
$ last reboot -F
reboot system boot 4.4.44-39.55.amz Wed Feb 15 09:16:30 2017 - Wed Feb 15 09:36:53 2017 (00:20) ... |
These are not entries of a boot user logging in or out, it's the system writing an entry upon reboot.
The entries are written when a reboot occurs, however, if the system was brought down in some other way (by unplugging the power or whatever), an entry would not have been written. I presume that the next orderly shut... | last reboot -F shows overlapping timespans |
1,389,235,186,000 |
I know that the command last | tac is enough, but I want to do it using the sort command. I cannot sort it by column, it always sorts the first one only.
Using bash on Arch Linux.
|
Looks like you can't rely on fields, so you'd need to rely on character column
1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890123456789
stephane pts/0 :0 Fri Aug 1 09:48 - 14:34 (17+04:45)
steph... | Sort the 'last' output by month |
1,389,235,186,000 |
I noticed that on one of my machines the last command returned nothing. I determined the cause of this to be an empty /var/log/wtmp file. What would cause this to be empty? I assume the "tmp" means temporary, but what and where decides how temporary this log file is?
|
/var/log/wtmp is usually rotated (or just cleared) by a monthly cron job, or with a config file in /etc/logrotate.d/
For example: on my Debian system, all the lines in /etc/logrotate.d/wtmp are commented out, but /etc/cron.monthly/acct (from the acct GNU Accounting Utilities package) rotates it and generates a monthly... | What causes wtmp to be cleared? |
1,389,235,186,000 |
I often use thelast command to check my systems for unauthorized logins, this command:
last -Fd
gives me the logins where I have remote logins showing with ip.
From man last:
-F Print full login and logout times and dates.
-d For non-local logins, Linux stores not only the host name of the remote host but its... |
It is likely that logrotate has archived the log(s) of interest and opened a new one. If you have older wtmp files, specify one of those, as for example:
last -f /var/log/wtmp-20141001
| last command only shows few days worth of logins |
1,389,235,186,000 |
This was a weird output I came across. Running the "last" command gave me this output
gryphon pts/0 192.168.0.108 Wed Mar 19 21:04 still logged in
gryphon pts/0 s0106d850e695678 Wed Mar 19 13:53 - 13:54 (00:01)
gryphon pts/0 192.168.0.108 Tue Mar 18 22:57 - 23:03 (00:06)
I'm pretty s... |
As Ricky Beam mentioned, it is a hostname, but sadly, it was too long and therefore cut off. If you want to display the entire host name without any trimming, run the command with the -F flag (capitalization matters).
$ last
andreas pts/15 123-27-247-110.c Fri Jun 13 00:24 - 00:33 (00:08)
$ last -w -F
andr... | Linux Last command weird output? Garbage for IP address |
1,389,235,186,000 |
We recently set up a new FreeBSD 7.2 machine on March 11. When looking at last, we noticed some funny characters for the TTY field.
What do these characters mean? Note that at this time, the sysadmin was battling with NTP.
# last |grep date
date { Fri Mar 10 17:26
date ... |
From utmp(5):
The system time has been manually or automatically updated (see
date(1)). The command name date is recorded in the field
ut_name. In the field ut_line, the character `|' indicates the
time prior to the change, and the character `{' indicates the
new time.
So the I and { are just there to indicate that... | Why does `last` show '{' and '|' in the TTY field? |
1,389,235,186,000 |
Is there a shortcut (keyboard) to automatically scroll back to the beginning of a response to a command?
Example: I open the terminal and type the 'last' command and press enter.
A long lost of previously logged in users appears but I am at the end (i.e. oldest users). Scrolling back up to the top can be a bit of a p... |
Not that I'm aware of, you'd normally pipe the output into a pager like less.
$ last | less
| Does a shortcut exist to auto scroll to the top of a command response in terminal? |
1,389,235,186,000 |
last
...
date { Sun Mar 31 12:00
date | Sun Mar 31 12:00
date { Sun Mar 31 00:00
date | Sun Mar 31 00:00
...
Why are there e.x.: "{" in the last commands output? Some so... |
The lines you are seeing indicate the system time has been automatically updated. The '|' character indicates the time prior to the change and the '{' character indicates the new time.
Source: man utmp (5)
| How to detect what is causing entries in the "last" cmd's output? [duplicate] |
1,389,235,186,000 |
What is the meaning of "crash" from the output of the last command?
root pts/0 mastrt03 Wed Jan 24 11:54 - crash (07:12)
We have couple of lines with "crash" on our mastrt03 machine.
|
last command shows crash as logout time when there is no logout time specified in wtmp database for a user session in linux os
Normally In last command will show user login time and log out time and Time Duration of logged in
If Logout for particular user not found in wtmp database. then it will mentioned as crash
| What is the meaning of "crash" from the output of the last command? |
1,389,235,186,000 |
So I'm creating a simple grep command that gets only the last logged in people who's username starts with 161 and has 3 digits next to it:
last | grep "^161[0-9]{3}"
However it doesn't print anything even though it has these usernames on the list.
Whats even more weirder is if I do egrep instead of grep
last | egrep... |
As steeldriver already pointed out, grep uses basic regular expressions whereas grep -E and egrep use extended regular expressions.
last | grep '^161[0-9]\{3\}'
last | egrep '^161[0-9]{3}'
| Grep regex not working [duplicate] |
1,389,235,186,000 |
When I run the last command on one of my Raspberry Pi's running Raspbian I get this at the end:
wtmp begins Thu Jan 1 01:00:01 1970
When I run the last command on a proper operating system, such as Ubuntu or Fedora I get a real date, not the epoch time. What's causing it and what does in mean (in both cases).
|
You are seeing this because the wtmp file is rotated at the 1st of each month. (e.g. wtmp is moved to wtmp.1 and a new wtmp is created empty).
In the Raspberry PI, as you do not have a Real Time Clock to keep the time, each time you (re)boot it you are back to Epoch 0 which is Jan 1, 1970.
The good news is that you ca... | Why do I get this at the end of a `last` command? |
1,389,235,186,000 |
I have the following lines extracted from the output of last. It shows two reboots, and that userA was logged in right up to the reboot. So far, I am able to interpret the data.
However, what I do not understand right now, is the login-time of the pseudo user reboot. For any ordinary users, the two times are the time ... |
Its refer to the time between reboots. i will explain with example:
root pts/0 192.168.10.58 Mon Nov 28 10:53 still logged in
reboot system boot 2.6.32-642.11.1. Mon Nov 28 10:14 - 11:00 (00:45)
root pts/0 192.168.10.58 Mon Nov 28 10:11 - down (00:02)
reboot system boot... | last - user reboot - logged-in period |
1,389,235,186,000 |
Is there a way to tell this command to output the data in local time (not UTC)?
last reboot
Version:
last --version
last von util-linux 2.27.1
|
Use TZ if you need some (troublesome on account of the horrible daylight savings time swings) local timezone, as @Toby indicates:
% TZ=US/Pacific last | sed -n /reboot/p | sed -n 1p
reboot system boot 2.6.32-642.1.1.e Mon Jul 25 09:55 - 08:47 (29+22:51)
% last | sed -n /reboot/p | sed -n 1p
reboot system boot ... | last reboot in local time zone? |
1,389,235,186,000 |
I have several remote systems connecting to my server via SSH to establish tunnels.
They authenticate using a public key, their user is locked and their shell is set to /usr/sbin/nologin
It all works fine except with this setup the output from last username is empty for those accounts.
Is there a workaround to get las... |
You could use awk on /var/log/secure or /var/log/auth.log (depending on the distro).
On my CentOS 7 I get the following when I log in remotely:
Dec 8 21:58:20 <server hostname> sshd[8387]: Accepted publickey for gareth from 1.2.3.4 port 58392 ssh2: RSA 55:89:f9:20:db:c6:e0:6f:ff:d4:a7
The above was for interactive l... | Unable to get last connection info for SSH users (locked, no shell, public key) is there an alternative? |
1,389,235,186,000 |
Hello I would like to know how to scan and change the last modified date of all subfolders based on the oldest file in each subfolder.
Example of Ubuntu folder structure:
home/incoming/media/Something.something.1234/
or
/Soemthing Soemthing 1234/
Which means there are folders with dots and without dots. Same goes fo... |
In zsh:
for dir in path/to/media/*(NF); do
oldest=( $dir/*.(mp4|mkv)(N.Om[1]) )
if (( $#oldest )) touch -r $oldest -- $dir
done
Beware the last modification time of a directory is updated any time an entry is added, removed or renamed in it, so that touch may not hold for long.
| Change the last modification time of subfolders to that of the oldest file inside |
1,305,731,391,000 |
I have currently a strange problem on debian (wheezy/amd64).
I have created a chroot to install a server (i can't give any more detail about it, sorry). Let's call its path /chr_path/.
To make things easy, I have initialized this chroot with a debootstrap (also wheezy/amd64).
All seemed to work well inside the chroot ... |
When you fail to execute a file that depends on a “loader”, the error you get may refer to the loader rather than the file you're executing.
The loader of a dynamically-linked native executable is the part of the system that's responsible for loading dynamic libraries. It's something like /lib/ld.so or /lib/ld-linux.... | Getting "Not found" message when running a 32-bit binary on a 64-bit system |
1,305,731,391,000 |
Assuming I want to test if a library is installed and usable by a program. I can use ldconfig -p | grep mylib to find out if it's installed on the system. but what if the library is only known via setting LD_LIBRARY_PATH?
In that case, the program may be able to find the library, but ldconfig won't. How can I check if... |
ldconfig can list all the libraries it has access to. These libraries are also stored in its cache.
/sbin/ldconfig -v -N will crawl all the usual library paths, list all the available libraries, without reconstructing the cache (which is not possible if you're a non-root user). It does NOT take into account libraries ... | Find out if library is in path |
1,305,731,391,000 |
I know this question isn't very new but it seems as if I didn't be able to fix my problem on myself.
ldd generate the following output
u123@PC-Ubuntu:~$ ldd /home/u123/Programme/TestPr/Debug/TestPr
linux-vdso.so.1 => (0x00007ffcb6d99000)
libcsfml-window.so.2.2 => not found
libcsfml-graphics.so.2.2 => not ... |
if your libraries are not on standard path then either you need to add them to the path or add non-standard path to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<Your_non-Standard_path>
Once you done any one of above things then you need to update the dynamic linker run-time binding by executing below comm... | ldd does not find path, How to add |
1,305,731,391,000 |
In my case, it seems as if LD_LIBRARY_PATH is set to the empty string. But all standard system tools still work fine, so I guess the dynamic linker checks for that case and uses some default for LD_LIBRARY_PATH in that case.
What is that default value? I guess it at least includes /usr/lib but what else? Is there any... |
The usual dynamic linker on Linux uses a cache to find its libraries. The cache is stored in /etc/ld.so.cache, and is updated by ldconfig which looks on the paths it’s given in /etc/ld.so.conf (and nowadays typically files in /etc/ld.so.conf.d). Its contents can be listed by running ldconfig -p.
So there is no default... | What is the default value of LD_LIBRARY_PATH? [duplicate] |
1,305,731,391,000 |
I have found by coincidence that on my Debian Jessie there is no LD_LIBRARY_PATH variable (to be exact printenv | grep LD shows nothing related to linker and echo "$LD_LIBRARY_PATH" shows also nothing).
This is the case in x terminal emulator (which might clear it due to setgid) as well as in basic terminal (Ctrl+Alt+... |
Yes, it is normal that you don't have any explicit LD_LIBRARY_PATH. Read also ldconfig(8) and ld-linux(8) and about the rpath. Notice that ldconfig updates /etc/ld.so.cache, not the LD_LIBRARY_PATH. Sometimes you'll set the rpath of an executable explicitly with -Wl,-rpath,directory passed to gcc at link time.
If you ... | Is it normal that LD_LIBRARY_PATH variable is missing from an environment? |
1,305,731,391,000 |
I have a binary executable named "alpha" that requires a linked library (libz.so.1.2.7) which is placed at /home/username/myproduct/lib/libz.so.1.2.7
I export the same to my terminal instance before spawning my binary executable by executing the following command.
export LD_LIBRARY_PATH=/home/username/myproduct/lib/:... |
But why does it not do the same until it finds the expected version rather than accepting the first instance of library irrespective of its version?
It does, as far as it’s aware. zlib.so.1.2.7 and zlib.so.1.2.8 both have an soname of zlib.so.1, so your alpha and bravo binaries say they need zlib.so.1. The dynamic l... | Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.